]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/cache-add-unpublished.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / cache-add-unpublished.js
1 var common = require("../common-tap.js")
2 var test = require("tap").test
3 var mr = require("npm-registry-mock")
4
5 test("cache add", function (t) {
6   setup(function (er, s) {
7     if (er) {
8       throw er
9     }
10     common.npm([
11       "cache",
12       "add",
13       "superfoo",
14       "--registry=http://localhost:1337/"
15     ], {}, function (er, c, so, se) {
16       if (er) throw er
17       t.ok(c, "got non-zero exit code")
18       t.equal(so, "", "nothing printed to stdout")
19       t.similar(se, /404 Not Found: superfoo/, "got expected error")
20       s.close()
21       t.end()
22     })
23   })
24 })
25
26 function setup (cb) {
27   var s = require("http").createServer(function (req, res) {
28     res.statusCode = 404
29     res.end("{\"error\":\"not_found\"}\n")
30   })
31   s.listen(1337, function () {
32     cb(null, s)
33   })
34 }