-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
service-tests/chocolatey.js
Outdated
})); | ||
|
||
t.create('version (pre) (not found)') | ||
.get('/v/not-a-real-package.json') |
There was a problem hiding this comment.
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?
service-tests/powershellgallery.js
Outdated
})); | ||
|
||
t.create('version (pre) (not found)') | ||
.get('/v/not-a-real-package.json') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
shields/service-tests/github.js
Lines 39 to 40 in 8ad176d
.get('/license/badges/badger.json?style=_shields_test') | |
.expectJSON({ name: 'license', value: 'missing', colorB: colorsB.red }); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
8d992db
to
0279848
Compare
Great. I've rebased and updated |
Thanks, Merged 🎉 |
If you merge #1471 ahead of this, I will rebase and refactor the 'unexpected' cases to use the abstraction @platan has added there.