Skip to content

Commit

Permalink
chore: allow repsonseCode setting in getVisibility (#6440)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored May 10, 2023
1 parent f064696 commit baae2d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit baae2d6

Please sign in to comment.