diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-06-06 08:34:31 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-06-13 23:44:43 +0400 |
commit | bb369f71a2fc4ba1c1fbfc3da41a4b1d11becca2 (patch) | |
tree | 5aa01a3635b911b6ebf671d3bec4878157373138 /node_modules/npm-registry-client/test/unpublish.js | |
parent | 1c2938189122c0640b9403746a6bfed4d6142b27 (diff) |
upgrade to npm-registry-client@2.0.0
Diffstat (limited to 'node_modules/npm-registry-client/test/unpublish.js')
-rw-r--r-- | node_modules/npm-registry-client/test/unpublish.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/node_modules/npm-registry-client/test/unpublish.js b/node_modules/npm-registry-client/test/unpublish.js new file mode 100644 index 000000000..e8a209306 --- /dev/null +++ b/node_modules/npm-registry-client/test/unpublish.js @@ -0,0 +1,59 @@ +var tap = require("tap") + +var server = require("./lib/server.js") +var common = require("./lib/common.js") +var client = common.freshClient({ + username : "othiym23", + password : "password", + email : "ogd@aoaioxxysz.net", + _auth : new Buffer("username : password").toString("base64"), + "always-auth" : true +}) + +var cache = require("./fixtures/underscore/cache.json") + +var REV = "/-rev/72-47f2986bfd8e8b55068b204588bbf484" +var VERSION = "1.3.2" + +tap.test("unpublish a package", function (t) { + server.expect("GET", "/underscore?write=true", function (req, res) { + t.equal(req.method, "GET") + + res.json(cache) + }) + + server.expect("PUT", "/underscore" + REV, function (req, res) { + t.equal(req.method, "PUT") + + var b = "" + req.setEncoding("utf-8") + req.on("data", function (d) { + b += d + }) + + req.on("end", function () { + var updated = JSON.parse(b) + t.notOk(updated.versions[VERSION]) + }) + + res.json(cache) + }) + + server.expect("GET", "/underscore", function (req, res) { + t.equal(req.method, "GET") + + res.json(cache) + }) + + server.expect("DELETE", "/underscore/-/underscore-1.3.2.tgz" + REV, function (req, res) { + t.equal(req.method, "DELETE") + + res.json({unpublished:true}) + }) + + client.unpublish("http://localhost:1337/underscore", VERSION, function (error) { + t.notOk(error, "no errors") + + t.end() + }) +}) |