forked from Netcentric/fe-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckChunk.test.js
More file actions
29 lines (22 loc) · 1020 Bytes
/
checkChunk.test.js
File metadata and controls
29 lines (22 loc) · 1020 Bytes
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
process.argv.push('--quiet');
const checkChunk = require("./checkChunk");
const vendor1 = './node_modules/mkFullPathSync/babel';
const vendor2 = './mkFullPathSync/node_modules/core-js';
const regular = './regular/test'
const excluded = ['babel', 'core-js']
describe('Test utils/checkChunk.js', () => {
it(`Should return false if a module comes empty`, () => {
expect(checkChunk('', [])).toBe(false);
});
it(`Should detect if a module is at included`, () => {
expect(checkChunk(vendor1, [], ['node_modules'])).toBe(true);
expect(checkChunk(vendor2, [], ['node_modules'])).toBe(true);
});
it(`Should detect if a module comes from included but is excluded`, () => {
expect(checkChunk(vendor1, [], ['node_modules'])).toBe(true);
expect(checkChunk(vendor1, excluded, ['node_modules'])).toBe(false);
});
it(`Should return false if is not on included `, () => {
expect(checkChunk(regular, [excluded], ['node_modules'])).toBe(false);
});
});