Skip to content

Commit

Permalink
test(libnpmpublish): unpublish from custom reg
Browse files Browse the repository at this point in the history
Adds a test that ensures it's possible to unpublish a specific version
of a package from a custom registry (containing multiple slashes)

Relates to: #4253
  • Loading branch information
ruyadorno committed Mar 1, 2022
1 parent 2db3eff commit 3b64112
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions workspaces/libnpmpublish/test/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,40 @@ t.test('basic test', async t => {
t.ok(ret, 'foo was unpublished')
})

t.test('unpublishing from a custom registry', async t => {
const opt = {
registry: 'https://artifactory.example.com/api/npm/npm-snapshots/',
}
const reg = opt.registry
const doc = {
_id: 'foo',
_rev: REV,
name: 'foo',
'dist-tags': {
latest: '1.0.1',
},
versions: {
'1.0.0': {
name: 'foo',
dist: {
tarball: `${reg}/foo/-/foo-1.0.0.tgz`,
},
},
'1.0.1': {
name: 'foo',
dist: {
tarball: `${reg}/foo/-/foo-1.0.1.tgz`,
},
},
},
}
const srv = tnock(t, reg)
srv.get('/foo?write=true').reply(200, doc)
srv.delete(`/foo/-rev/${REV}`).reply(201)
const ret = await unpub('[email protected]', opt)
t.ok(ret, 'foo was unpublished')
})

t.test('scoped basic test', async t => {
const doc = {
_id: '@foo/bar',
Expand Down

0 comments on commit 3b64112

Please sign in to comment.