Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chocolatey powershellgallery] add service tests for NuGet v2 services #1487

Merged
merged 5 commits into from
Feb 13, 2018

Conversation

chris48s
Copy link
Member

@chris48s chris48s commented Feb 4, 2018

If you merge #1471 ahead of this, I will rebase and refactor the 'unexpected' cases to use the abstraction @platan has added there.

@shields-ci
Copy link

shields-ci commented Feb 4, 2018

Warnings
⚠️

This PR modified helper functions in lib/ but not accompanying tests. That's okay so long as it's refactoring existing code.

Messages
📖

✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS

@@ -51,7 +51,7 @@ function mapNugetFeedv2({ camp, cache }, pattern, offset, getInfo) {
const badgeData = getBadgeData(site, data);
getNugetPackage(apiUrl, repo, null, request, function(err, data) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
badgeData.text[1] = err.message;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few lines below there is a try-catch block. Catch block does not have tests. But in my opinion try-catch is unnecessary and can be removed. What do you think about it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the JSON.parse() error is caught in getNugetPackage() so I've removed the others

}));

t.create('version (pre) (not found)')
.get('/v/not-a-real-package.json')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have /vpre/... here?

}));

t.create('version (pre) (not found)')
.get('/v/not-a-real-package.json')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have /vpre/... here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch :)

.expectJSON({name: 'chocolatey', value: 'invalid'});


// version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"version" and "pre version" badge can have different colors (yellow, orange or blue). Would you like to test these cases? Color value can be check using this approach

.get('/license/badges/badger.json?style=_shields_test')
.expectJSON({ name: 'license', value: 'missing', colorB: colorsB.red });

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had not realised that it we had an endpoint to test the colours but I now see you added this in #1190 - this would probably be helpful in some other tests.

I think it would also be helpful to add an example to the testing docs to explain this feature for other contributors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you. I will try to add such example.

Copy link
Member

@platan platan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@RedSparr0w
Copy link
Member

Thanks @chris48s, All looks good to me.
#1471 has been merged, if you could please update this i can merge 😄

Thanks @platan for reviewing.

@chris48s
Copy link
Member Author

Great. I've rebased and updated

@RedSparr0w
Copy link
Member

Thanks, Merged 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants