-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathspec.js
33 lines (27 loc) · 926 Bytes
/
spec.js
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
const { clean, override } = abuser(__filename);
const distribute = fake.returns('Distribute');
const split = fake.returns('Split');
const noop = () => null;
let arraySelect;
describe('array-select', () => {
before(() => {
override('./lib/distribute', distribute);
override('./lib/split', split);
arraySelect = require('.');
});
afterEach(() => {
distribute.resetHistory();
split.resetHistory();
});
after(() => clean('.'));
it('Should call split with arguments, and return its return value', () => {
const returnValue = arraySelect([ 1 ], noop);
expect(split).to.have.been.calledWith([ 1 ], noop);
expect(returnValue).to.equal('Split');
});
it('Should call distribute with arguments, and return its return value', () => {
const returnValue = arraySelect([ 1 ], noop, noop);
expect(distribute).to.have.been.calledWith([ 1 ], noop, noop);
expect(returnValue).to.equal('Distribute');
});
});