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

fix [github] service tests #9425

Merged
merged 5 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/github/github-downloads.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export default class GithubDownloads extends GithubAuthV3Service {
}

if (releases.length === 0) {
throw new NotFound({ prettyMessage: 'no releases' })
throw new NotFound({ prettyMessage: 'no releases found' })
Copy link
Member Author

Choose a reason for hiding this comment

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

The issue here is that fetchLatestRelease() (which we also call in this service) throws "no releases found". I've brought the message for both services into line.

}

const { downloads } = this.constructor.transform({
Expand Down
6 changes: 3 additions & 3 deletions services/github/github-downloads.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ t.create('Downloads all releases')

t.create('Downloads all releases (no releases)')
.get('/downloads/badges/shields/total.json')
.expectBadge({ label: 'downloads', message: 'no releases' })
.expectBadge({ label: 'downloads', message: 'no releases found' })

t.create('Downloads-pre all releases (no releases)')
.get('/downloads-pre/badges/shields/total.json')
.expectBadge({ label: 'downloads', message: 'no releases' })
.expectBadge({ label: 'downloads', message: 'no releases found' })

t.create('Downloads all releases (repo not found)')
.get('/downloads/badges/helmets/total.json')
Expand Down Expand Up @@ -154,7 +154,7 @@ t.create('downloads-pre for latest release')
// https://github.com/badges/shields/issues/3786
t.create('downloads-pre for latest release (no-releases)')
.get('/downloads-pre/badges/shields/latest/total.json')
.expectBadge({ label: 'downloads', message: 'no releases' })
.expectBadge({ label: 'downloads', message: 'no releases found' })

t.create('downloads for release without slash')
.get('/downloads/atom/atom/v0.190.0/total.json')
Expand Down
10 changes: 4 additions & 6 deletions services/github/github-lerna-json.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ t.create('Lerna version').get('/facebook/jest.json').expectBadge({
message: isSemver,
})

t.create('Lerna version (independent)')
.get('/jneander/jneander.json')
.expectBadge({
label: 'lerna',
message: 'independent',
})
t.create('Lerna version (independent)').get('/imba/imba.json').expectBadge({
label: 'lerna',
message: 'independent',
})

t.create('Lerna version (branch)').get('/facebook/jest/main.json').expectBadge({
label: 'lerna@main',
Expand Down
4 changes: 2 additions & 2 deletions services/github/github-package-json.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ t.create('Prod dependency version (monorepo)')
})

t.create('Scoped dependency')
.get('/dependency-version/badges/shields/dev/@babel/core.json')
.get('/dependency-version/badges/shields/dev/@docusaurus/core.json')
.expectBadge({
label: '@babel/core',
label: '@docusaurus/core',
message: semverRange,
})

Expand Down
6 changes: 4 additions & 2 deletions services/github/github-pipenv.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ t.create('Locked version of unknown dependency')
})

t.create('Locked version of VCS dependency')
.get('/locked/dependency-version/GSS-Cogs/databaker-docker/databaker.json')
.get(
'/locked/dependency-version/thorn-oss/perception/dev/videoalignment.json',
)
.expectBadge({
label: 'databaker',
label: 'videoalignment',
message: isShortSha,
})
2 changes: 1 addition & 1 deletion services/github/github-search.tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ t.create('hit counter')

t.create('hit counter for nonexistent repo')
.get('/badges/puppets/async%20handle.json')
.expectBadge({ label: 'counter', message: 'repo not found' })
.expectBadge({ label: 'async handle counter', message: '0' })
Copy link
Member Author

Choose a reason for hiding this comment

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

This query no longer throws a 404 for repo doesn't exist - it just says zero results

Copy link
Member

Choose a reason for hiding this comment

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

Well, this is unfortunate.

Loading