1 | const check = require('../') |
||
2 | |||
3 | const spy = jest.spyOn(console, 'log').mockImplementation(() => {}) |
||
0 ignored issues
–
show
|
|||
4 | |||
5 | const TIMEOUT = 3000 |
||
6 | |||
7 | describe('Input helper', () => { |
||
8 | it('check should works', done => { |
||
9 | const input = 'src/test/sample.html' |
||
10 | const output = null |
||
11 | const options = { |
||
12 | rules: { strong: { threadhold: 2 } }, |
||
13 | order: ['img', 'strong', 'a'], |
||
14 | path: 'rules' |
||
15 | } |
||
16 | check(input, output, options) |
||
17 | setTimeout(() => { |
||
18 | try { |
||
19 | expect(spy).toHaveBeenCalled() |
||
20 | expect(spy.mock.calls[0][0]).toBe( |
||
21 | 'There are 2 <img> tag without alt attribute' |
||
22 | ) |
||
23 | expect(spy.mock.calls[1][0]).toBe( |
||
24 | 'This HTML has more than 2 <strong> tag' |
||
25 | ) |
||
26 | expect(spy.mock.calls[2][0]).toBe( |
||
27 | 'There are 1 <a> tag without rel attribute' |
||
28 | ) |
||
29 | done() |
||
30 | } catch (err) { |
||
31 | done.fail(err) |
||
32 | } |
||
33 | }, TIMEOUT) |
||
34 | }) |
||
35 | }) |
||
36 |
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.