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

chore: allow repsonseCode setting in getVisibility #6440

Merged
merged 1 commit into from
May 10, 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
4 changes: 2 additions & 2 deletions mock-registry/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ class MockRegistry {
).reply(200)
}

getVisibility ({ spec, visibility }) {
getVisibility ({ spec, visibility, responseCode = 200 }) {
this.nock = this.nock.get(
this.fullPath(`/-/package/${npa(spec).escapedName}/visibility`))
.reply(200, visibility)
.reply(responseCode, visibility)
}

setPermissions ({ spec, team, permissions }) {
Expand Down
6 changes: 2 additions & 4 deletions workspaces/libnpmpublish/test/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,7 @@ t.test('publish new package with provenance in gha when visibility 404s - no acc
description: 'test libnpmpublish package',
}
const spec = npa(manifest.name)
registry.nock.get(`/-/package/${npa(spec).escapedName}/visibility`)
.reply(404)
registry.getVisibility({ spec, responseCode: 404 })

await t.rejects(
publish(manifest, Buffer.from(''), {
Expand Down Expand Up @@ -915,8 +914,7 @@ t.test('publish new package with provenance in gha when visibility 500s - no acc
description: 'test libnpmpublish package',
}
const spec = npa(manifest.name)
registry.nock.get(`/-/package/${npa(spec).escapedName}/visibility`)
.reply(500)
registry.getVisibility({ spec, responseCode: 500 })

await t.rejects(
publish(manifest, Buffer.from(''), {
Expand Down