@@ -26,15 +26,13 @@ describe('The lesshint provider for Linter', () => {
26
26
27
27
it ( 'fails file that breaks lesshint' , ( ) => {
28
28
waitsForPromise ( ( ) => {
29
-
30
29
const priorNotificationsCount = atom . notifications . getNotifications ( ) . length ;
31
30
32
31
return lint ( editor ) . then ( ( ) => {
33
-
34
32
const notifications = atom . notifications . getNotifications ( ) ;
35
33
36
34
expect ( notifications [ priorNotificationsCount ] . getType ( ) ) . toEqual ( 'error' ) ;
37
- expect ( notifications [ priorNotificationsCount ] . getMessage ( ) ) . toEqual ( ' lesshint couldn\ 't check this file.' ) ;
35
+ expect ( notifications [ priorNotificationsCount ] . getMessage ( ) ) . toEqual ( " lesshint couldn't check this file." ) ;
38
36
} ) ;
39
37
} ) ;
40
38
} ) ;
@@ -54,16 +52,13 @@ describe('The lesshint provider for Linter', () => {
54
52
} ) ;
55
53
56
54
it ( 'fails file with errors' , ( ) => {
57
- const errorName = 'emptyRule' ;
58
55
const errorMessage = "There shouldn't be any empty rules present." ;
56
+ const errorName = 'emptyRule' ;
59
57
60
58
waitsForPromise ( ( ) => {
61
59
return lint ( editor ) . then ( ( messages ) => {
62
- expect ( messages [ 0 ] . type ) . toBeDefined ( ) ;
63
60
expect ( messages [ 0 ] . type ) . toEqual ( 'warning' ) ;
64
- expect ( messages [ 0 ] . html ) . toBeDefined ( ) ;
65
61
expect ( messages [ 0 ] . html ) . toEqual ( `<span class='badge badge-flexible'>${ errorName } </span> ${ errorMessage } ` ) ;
66
- expect ( messages [ 0 ] . filePath ) . toBeDefined ( ) ;
67
62
expect ( messages [ 0 ] . filePath ) . toMatch ( / .+ i n v a l i d \. l e s s $ / ) ;
68
63
expect ( messages [ 0 ] . range ) . toEqual ( new Range ( [ 1 , 0 ] , [ 1 , 4 ] ) ) ;
69
64
} ) ;
@@ -128,14 +123,17 @@ describe('The lesshint provider for Linter', () => {
128
123
} ) ;
129
124
} ) ;
130
125
} ) ;
126
+
131
127
it ( 'checks with global config when enabled' , ( ) => {
132
128
atom . config . set ( 'linter-lesshint.globalConfig' , true ) ;
129
+
133
130
waitsForPromise ( ( ) => {
134
131
return lint ( editor ) . then ( ( messages ) => {
135
132
expect ( messages . length ) . toEqual ( 0 ) ;
136
133
} ) ;
137
134
} ) ;
138
135
} ) ;
136
+
139
137
it ( 'does not check with global config when disabled' , ( ) => {
140
138
atom . config . set ( 'linter-lesshint.globalConfig' , false ) ;
141
139
@@ -147,8 +145,7 @@ describe('The lesshint provider for Linter', () => {
147
145
} ) ;
148
146
} ) ;
149
147
150
-
151
- describe ( 'valid file' , ( ) => {
148
+ describe ( 'invalid file' , ( ) => {
152
149
beforeEach ( ( ) => {
153
150
waitsForPromise ( ( ) => {
154
151
return atom . workspace . open ( `${ __dirname } /fixtures/invalid-global.less` ) . then ( ( openEditor ) => {
@@ -159,14 +156,17 @@ describe('The lesshint provider for Linter', () => {
159
156
160
157
it ( 'checks with global config when enabled' , ( ) => {
161
158
atom . config . set ( 'linter-lesshint.globalConfig' , true ) ;
159
+
162
160
waitsForPromise ( ( ) => {
163
161
return lint ( editor ) . then ( ( messages ) => {
164
162
expect ( messages . length ) . toEqual ( 1 ) ;
165
163
} ) ;
166
164
} ) ;
167
165
} ) ;
166
+
168
167
it ( 'does not check with global config when disabled' , ( ) => {
169
168
atom . config . set ( 'linter-lesshint.globalConfig' , false ) ;
169
+
170
170
waitsForPromise ( ( ) => {
171
171
return lint ( editor ) . then ( ( messages ) => {
172
172
expect ( messages . length ) . toEqual ( 0 ) ;
0 commit comments