src/test/index.test.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 35
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
c 1
b 0
f 0
nc 1
mnd 1
bc 6
fnc 4
dl 0
loc 35
rs 10
bpm 1.5
cpm 1.25
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A index.test.js ➔ ??? 0 1 1
1
const check = require('../')
2
3
const spy = jest.spyOn(console, 'log').mockImplementation(() => {})
0 ignored issues
show
Bug introduced by
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