@@ -10,64 +10,60 @@ const invalidCss = fs.readFileSync('./__tests__/invalid.css', 'utf-8');
10
10
describe ( 'flags no warnings with valid css' , ( ) => {
11
11
let result ;
12
12
13
- beforeEach ( ( ) => {
14
- result = stylelint . lint ( {
13
+ beforeEach ( async ( ) => {
14
+ result = await stylelint . lint ( {
15
15
code : validCss ,
16
16
config,
17
17
} ) ;
18
18
} ) ;
19
19
20
- it ( 'did not error ' , ( ) => {
21
- return result . then ( ( data ) => expect ( data . errored ) . toBeFalsy ( ) ) ;
20
+ it ( 'has no errors ' , ( ) => {
21
+ expect ( result . errored ) . toBe ( false ) ;
22
22
} ) ;
23
23
24
24
it ( 'flags no warnings' , ( ) => {
25
- return result . then ( ( data ) => expect ( data . results [ 0 ] . warnings ) . toHaveLength ( 0 ) ) ;
25
+ expect ( result . results [ 0 ] . warnings ) . toHaveLength ( 0 ) ;
26
26
} ) ;
27
27
} ) ;
28
28
29
29
describe ( 'flags warnings with invalid css' , ( ) => {
30
30
let result ;
31
31
32
- beforeEach ( ( ) => {
33
- result = stylelint . lint ( {
32
+ beforeEach ( async ( ) => {
33
+ result = await stylelint . lint ( {
34
34
code : invalidCss ,
35
35
config,
36
36
} ) ;
37
37
} ) ;
38
38
39
- it ( 'did error' , ( ) => {
40
- return result . then ( ( data ) => expect ( data . errored ) . toBeTruthy ( ) ) ;
39
+ it ( 'includes an error' , ( ) => {
40
+ expect ( result . errored ) . toBe ( true ) ;
41
41
} ) ;
42
42
43
43
it ( 'flags one warning' , ( ) => {
44
- return result . then ( ( data ) => expect ( data . results [ 0 ] . warnings ) . toHaveLength ( 1 ) ) ;
44
+ expect ( result . results [ 0 ] . warnings ) . toHaveLength ( 1 ) ;
45
45
} ) ;
46
46
47
- it ( 'correct warning text' , ( ) => {
48
- return result . then ( ( data ) =>
49
- expect ( data . results [ 0 ] . warnings [ 0 ] . text ) . toBe (
50
- 'Unexpected unknown type selector "madeup" (selector-type-no-unknown)' ,
51
- ) ,
47
+ it ( 'corrects warning text' , ( ) => {
48
+ expect ( result . results [ 0 ] . warnings [ 0 ] . text ) . toBe (
49
+ 'Unexpected unknown type selector "madeup" (selector-type-no-unknown)' ,
52
50
) ;
53
51
} ) ;
54
52
55
- it ( 'correct rule flagged' , ( ) => {
56
- return result . then ( ( data ) =>
57
- expect ( data . results [ 0 ] . warnings [ 0 ] . rule ) . toBe ( 'selector-type-no-unknown' ) ,
58
- ) ;
53
+ it ( 'corrects rule flagged' , ( ) => {
54
+ expect ( result . results [ 0 ] . warnings [ 0 ] . rule ) . toBe ( 'selector-type-no-unknown' ) ;
59
55
} ) ;
60
56
61
- it ( 'correct severity flagged' , ( ) => {
62
- return result . then ( ( data ) => expect ( data . results [ 0 ] . warnings [ 0 ] . severity ) . toBe ( 'error' ) ) ;
57
+ it ( 'corrects severity flagged' , ( ) => {
58
+ expect ( result . results [ 0 ] . warnings [ 0 ] . severity ) . toBe ( 'error' ) ;
63
59
} ) ;
64
60
65
- it ( 'correct line number' , ( ) => {
66
- return result . then ( ( data ) => expect ( data . results [ 0 ] . warnings [ 0 ] . line ) . toBe ( 1 ) ) ;
61
+ it ( 'corrects line number' , ( ) => {
62
+ expect ( result . results [ 0 ] . warnings [ 0 ] . line ) . toBe ( 1 ) ;
67
63
} ) ;
68
64
69
- it ( 'correct column number' , ( ) => {
70
- return result . then ( ( data ) => expect ( data . results [ 0 ] . warnings [ 0 ] . column ) . toBe ( 1 ) ) ;
65
+ it ( 'corrects column number' , ( ) => {
66
+ expect ( result . results [ 0 ] . warnings [ 0 ] . column ) . toBe ( 1 ) ;
71
67
} ) ;
72
68
} ) ;
73
69
0 commit comments