Issues (11)

src/test/rules/index.test.js (1 issue)

Labels
Severity
1
const { join } = require('path')
2
3
const loadRules = require('../../rules')
4
5
jest.mock('../../helper/rules')
0 ignored issues
show
The variable jest seems to be never declared. If this is a global, consider adding a /** global: jest */ comment.

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.

Loading history...
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