1 | describe('npm-registry', function () {
|
2 | 'use strict';
|
3 |
|
4 | var chai = require('chai')
|
5 | , expect = chai.expect;
|
6 |
|
7 | var Registry = require('../')
|
8 | , registry = new Registry();
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var module = 'eventemitter3';
|
15 |
|
16 | it('exposes an object of mirrors', function () {
|
17 | expect(Registry.mirrors).to.be.a('object');
|
18 | expect(Object.keys(Registry.mirrors).length).to.be.above(1);
|
19 | });
|
20 |
|
21 | it('sets authorization information when provided with with user/pass', function () {
|
22 | expect(registry.authorization).to.equal(undefined);
|
23 |
|
24 | var reg = new Registry({ user: 'foo', password: 'bar' });
|
25 |
|
26 | expect(reg.authorization).to.not.equal(undefined);
|
27 | expect(reg.authorization).to.be.a('string');
|
28 | });
|
29 |
|
30 | it('defaults to Nodejitsu\'s replica', function () {
|
31 | expect(registry.api).to.equal(Registry.mirrors.nodejitsu);
|
32 | });
|
33 |
|
34 | it('has a customizable registry', function () {
|
35 | var reg = new Registry({ registry: Registry.mirrors.strongloop });
|
36 | expect(reg.api).to.equal(Registry.mirrors.strongloop);
|
37 | });
|
38 |
|
39 | it('sets api mirrors by default', function () {
|
40 | var mirrors = Object.keys(Registry.mirrors);
|
41 |
|
42 | expect(registry.mirrors).to.be.a('array');
|
43 | expect(registry.mirrors.length).to.equal(mirrors.length);
|
44 |
|
45 | mirrors.forEach(function (key) {
|
46 | expect(registry.mirrors).to.contain(Registry.mirrors[key]);
|
47 | });
|
48 | });
|
49 |
|
50 | });
|