0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

test: Add functional test to un publish a single version

This commit is contained in:
Juan Picado @jotadeveloper 2017-07-30 17:55:41 +02:00
parent 442305c62f
commit 6f006fbf40
No known key found for this signature in database
GPG key ID: 18AC54485952D158
2 changed files with 33 additions and 0 deletions

View file

@ -30,6 +30,10 @@ module.exports = function() {
return server.addPackage('testpkg');
});
before(function() {
return server.addPackage('testpkg-single-tarball');
});
it('creating new package', function() {/* test for before() */});
it('downloading non-existent tarball', function() {
@ -48,6 +52,12 @@ module.exports = function() {
.body_ok(/.*/);
});
before(function() {
return server.putTarball('testpkg-single-tarball', 'single', readfile('fixtures/binary'))
.status(201)
.body_ok(/.*/);
});
after(function() {
return server.removeTarball('testpkg').status(201);
});
@ -64,6 +74,18 @@ module.exports = function() {
return server.removeTarball('testpkg404').status(404);
});
it('remove non existing single tarball', function() {
return server.removeSingleTarball('', 'fakeFile').status(404);
});
// testexp-incomplete
it('remove existing single tarball', function() {
return server.removeSingleTarball('testpkg-single-tarball', 'single').status(201);
});
// testexp-incomplete
it('downloading newly created tarball', function() {
return server.getTarball('testpkg', 'blahblah')
.status(200)

View file

@ -118,6 +118,17 @@ class Server {
});
}
removeSingleTarball(name, filename) {
return this.request({
uri: `/${encodeURIComponent(name)}/-/${filename}/-rev/whatever`,
method: 'DELETE',
headers: {
'content-type': 'application/json; charset=utf-8',
},
});
}
addTag(name, tag, version) {
return this.request({
uri: `/${encodeURIComponent(name)}/${encodeURIComponent(tag)}`,