summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/404-private-registry-scoped.js
blob: 681fff05e8ec5faf203158c8eee62ae605014a6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var nock = require('nock')
var test = require('tap').test
var npm = require('../../')
var addNamed = require('../../lib/cache/add-named')

test('scoped package names not mangled on error with non-root registry', function test404 (t) {
  nock('http://localhost:1337')
    .get('/registry/@scope%2ffoo')
    .reply(404, {
      error: 'not_found',
      reason: 'document not found'
    })

  npm.load({registry: 'http://localhost:1337/registry', global: true}, function () {
    addNamed('@scope/foo', '*', null, function checkError (err) {
      t.ok(err, 'should error')
      t.equal(err.message, '404 Not Found: @scope/foo', 'should have package name in error')
      t.equal(err.pkgid, '@scope/foo', 'err.pkgid should match package name')
      t.end()
    })
  })
})