Issues (11)

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

Labels
Severity
1
const check = require('../')
2
3
const spy = jest.spyOn(console, 'log').mockImplementation(() => {})
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...
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