proxyquire-non-object.js
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*jshint asi:true*/
/*global describe, before, it */
"use strict";
var assert = require('assert')
, proxyquire = require('..')
, stats = require('./samples/stats')
;
describe('Given foo requires the boof, foonum and foobool modules and boof is a string, foonum is a Number and foobool is a bool', function () {
var file = '/folder/test.ext'
, foo
, boofber = 'a_string'
, foonumber = 4
, fooboolber = false
;
describe('When I resolve foo with boofber stub as boof.', function () {
before(function () {
stats.reset();
foo = proxyquire('./samples/foo', { './boof':boofber})
})
it('foo is required 1 times', function () {
assert.equal(stats.fooRequires(), 1);
})
describe('foo\'s boof is boofber', function () {
it('foo.boof == boofber', function () {
assert.equal(foo.boof, boofber);
})
})
})
describe('When I resolve foo with foonumber stub as foonum.', function () {
before(function () {
stats.reset();
foo = proxyquire('./samples/foo', { './foonum':foonumber})
})
it('foo is required 1 times', function () {
assert.equal(stats.fooRequires(), 1);
})
describe('foo\'s foonum is foonumber', function () {
it('foo.foonum == foonumber', function () {
assert.equal(foo.foonum, foonumber);
})
})
})
describe('When I resolve foo with fooboolber stub as foobool.', function () {
before(function () {
stats.reset();
foo = proxyquire('./samples/foo', { './foobool':fooboolber})
})
it('foo is required 1 times', function () {
assert.equal(stats.fooRequires(), 1);
})
describe('foo\'s foobool is fooboolber', function () {
it('foo.foobool == fooboolber', function () {
assert.equal(foo.foobool, fooboolber);
})
})
})
})