-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
54 lines (49 loc) · 991 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* eslint-disable no-undef */
const config = require('./index')
const stylelint = require('stylelint')
const validCss = `/**
* Multi-line comment
*/
.selector-1,
.selector-2,
.selector-3[type='text'] {
background: linear-gradient(#fff, rgba(0, 0, 0, 0.8));
box-sizing: border-box;
color: #333;
display: block;
}
`
const invalidCss = `a {
top: .2em;
},
.test{
background: red !important;
margin: 0;
color: blue;
margin: 0 auto;
}
`
test('It returns no warnings with valid .scss', () => {
return stylelint
.lint({
code: validCss,
config,
})
.then(data => {
const { results } = data
const { warnings } = results[0]
expect(warnings.length).toBe(0)
})
})
test('It returns warnings with invalid .scss', () => {
return stylelint
.lint({
code: invalidCss,
config,
})
.then(data => {
const { results } = data
const { warnings } = results[0]
expect(warnings.length).toBe(7)
})
})