diff --git a/test/functional/basic.js b/test/functional/basic.js index 6cd845630..6dc940ca8 100644 --- a/test/functional/basic.js +++ b/test/functional/basic.js @@ -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) diff --git a/test/functional/lib/server.js b/test/functional/lib/server.js index bdaa2ab80..958aa7e72 100644 --- a/test/functional/lib/server.js +++ b/test/functional/lib/server.js @@ -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)}`,