Total Complexity | 4 |
Complexity/F | 1 |
Lines of Code | 23 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | const { join } = require('path') |
||
2 | |||
3 | const loadRules = require('../../rules') |
||
4 | |||
5 | jest.mock('../../helper/rules') |
||
|
|||
6 | const { getAllRuleName, load } = require('../../helper/rules') |
||
7 | |||
8 | describe('Rules helper', () => { |
||
9 | it('input is a file path', () => { |
||
10 | getAllRuleName.mockImplementation(() => ['a', 'b', 'c', 'd']) |
||
11 | load.mockImplementation(name => name) |
||
12 | const options = { |
||
13 | order: ['c', 'x', 'a'], |
||
14 | path: 'rules' |
||
15 | } |
||
16 | const expected = [ |
||
17 | join(__dirname, '../../rules', 'c'), |
||
18 | join(__dirname, '../../rules', 'a') |
||
19 | ] |
||
20 | const ruleFunc = loadRules(options) |
||
21 | expect(ruleFunc).toEqual(expected) |
||
22 | }) |
||
23 | }) |
||
24 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.