summaryrefslogtreecommitdiff
path: root/deps/npm/test
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test')
-rw-r--r--deps/npm/test/tap/install-save-prefix.js4
-rw-r--r--deps/npm/test/tap/referer.js24
2 files changed, 26 insertions, 2 deletions
diff --git a/deps/npm/test/tap/install-save-prefix.js b/deps/npm/test/tap/install-save-prefix.js
index 0ce6e02fa..9cb6bd9cb 100644
--- a/deps/npm/test/tap/install-save-prefix.js
+++ b/deps/npm/test/tap/install-save-prefix.js
@@ -25,13 +25,13 @@ test('"npm install --save with default save-prefix should install local pkg vers
registry: common.registry }, function(err) {
t.ifError(err)
npm.config.set('save', true)
- npm.commands.install(['underscore@1.3.1'], function(err) {
+ npm.commands.install(['underscore@latest'], function(err) {
t.ifError(err)
var p = path.resolve(pkg, 'node_modules/underscore/package.json')
t.ok(JSON.parse(fs.readFileSync(p)))
var pkgJson = JSON.parse(fs.readFileSync(pkg + '/package.json', 'utf8'))
t.deepEqual(pkgJson.dependencies, {
- 'underscore': '^1.3.1'
+ 'underscore': '^1.5.1'
}, 'Underscore dependency should specify ^1.3.1')
npm.config.set('save', undefined)
s.close()
diff --git a/deps/npm/test/tap/referer.js b/deps/npm/test/tap/referer.js
new file mode 100644
index 000000000..1b55ab026
--- /dev/null
+++ b/deps/npm/test/tap/referer.js
@@ -0,0 +1,24 @@
+var common = require("../common-tap.js")
+var test = require("tap").test
+var http = require("http")
+var server
+
+test("should send referer http header", function (t) {
+ var server = http.createServer(function (q, s) {
+ t.equal(q.headers.referer, "install foo")
+ s.statusCode = 404
+ s.end(JSON.stringify({error: "whatever"}))
+ this.close()
+ }).listen(common.port, function () {
+ var reg = "--registry=http://localhost:" + common.port
+ var args = [ "install", "foo", reg ]
+ common.npm(args, {}, function (er, code, so, se) {
+ if (er) {
+ throw er
+ }
+ // should not have ended nicely, since we returned an error
+ t.ok(code)
+ t.end()
+ })
+ })
+})