@@ -25,8 +25,6 @@ function retrieveParams(subpath) {
25
25
function compareTextFiles ( file1Path , file2Path ) {
26
26
const file1Content = fs . readFileSync ( file1Path , 'utf-8' )
27
27
const file2Content = fs . readFileSync ( file2Path , 'utf-8' )
28
- console . log ( 'file1Content :>> ' , file1Content )
29
- console . log ( 'file2Content :>> ' , file2Content )
30
28
return file1Content === file2Content
31
29
}
32
30
@@ -52,6 +50,8 @@ function useFixture(dir) {
52
50
53
51
describe ( 'e2e' , function ( ) {
54
52
let result = false
53
+ let code
54
+ let stdout
55
55
56
56
describe ( 'autofix tests' , ( ) => {
57
57
if ( E2E ) {
@@ -166,19 +166,23 @@ describe('e2e', function () {
166
166
expect ( result ) . to . be . true
167
167
} )
168
168
169
- it ( 'should compare Foo1 file with template AFTER FIX file and they should match (2)' , ( ) => {
170
- const { code, stdout } = shell . exec (
169
+ it ( 'should execute and compare Foo1 with template AFTER FIX and they should match (2)' , ( ) => {
170
+ ( { code, stdout } = shell . exec (
171
171
`${ params . command } ${ params . param1 } -c ${ currentConfig } ${ currentFile } --fix --disc --noPrompt`
172
- )
172
+ ) )
173
+
174
+ result = compareTextFiles ( currentFile , afterFixFile )
175
+ expect ( result ) . to . be . true
176
+ } )
173
177
178
+ it ( 'should execute and exit with code 1 (2)' , ( ) => {
174
179
expect ( code ) . to . equal ( 1 )
180
+ } )
175
181
182
+ it ( 'should get the right report (2)' , ( ) => {
176
183
const reportLines = stdout . split ( '\n' )
177
184
const finalLine = '5 problems (5 errors, 0 warnings)'
178
185
expect ( reportLines [ reportLines . length - 3 ] ) . to . contain ( finalLine )
179
-
180
- result = compareTextFiles ( currentFile , afterFixFile )
181
- expect ( result ) . to . be . true
182
186
} )
183
187
} )
184
188
@@ -208,19 +212,23 @@ describe('e2e', function () {
208
212
expect ( result ) . to . be . true
209
213
} )
210
214
211
- it ( 'should compare Foo1 file with template AFTER FIX file and they should match (3)' , ( ) => {
212
- const { code, stdout } = shell . exec (
215
+ it ( 'should execute and compare Foo1 with template AFTER FIX and they should match (3)' , ( ) => {
216
+ ( { code, stdout } = shell . exec (
213
217
`${ params . command } ${ params . param1 } -c ${ currentConfig } ${ currentFile } --fix --disc --noPrompt`
214
- )
218
+ ) )
219
+
220
+ result = compareTextFiles ( currentFile , afterFixFile )
221
+ expect ( result ) . to . be . true
222
+ } )
215
223
224
+ it ( 'should execute and exit with code 1 (3)' , ( ) => {
216
225
expect ( code ) . to . equal ( 1 )
226
+ } )
217
227
228
+ it ( 'should get the right report (3)' , ( ) => {
218
229
const reportLines = stdout . split ( '\n' )
219
230
const finalLine = '9 problems (9 errors, 0 warnings)'
220
231
expect ( reportLines [ reportLines . length - 3 ] ) . to . contain ( finalLine )
221
-
222
- result = compareTextFiles ( currentFile , afterFixFile )
223
- expect ( result ) . to . be . true
224
232
} )
225
233
} )
226
234
@@ -250,31 +258,33 @@ describe('e2e', function () {
250
258
expect ( result ) . to . be . true
251
259
} )
252
260
253
- it ( 'should compare Foo1 file with template AFTER FIX file and they should match (4)' , ( ) => {
254
- const { code, stdout } = shell . exec (
261
+ it ( 'should execute and compare Foo1 with template AFTER FIX and they should match (4)' , ( ) => {
262
+ ( { code, stdout } = shell . exec (
255
263
`${ params . command } ${ params . param1 } -c ${ currentConfig } ${ currentFile } --fix --disc --noPrompt`
256
- )
264
+ ) )
257
265
266
+ result = compareTextFiles ( currentFile , afterFixFile )
267
+ expect ( result ) . to . be . true
268
+ } )
269
+
270
+ it ( 'should execute and exit with code 1 (4)' , ( ) => {
258
271
expect ( code ) . to . equal ( 1 )
272
+ } )
259
273
274
+ it ( 'should get the right report (4)' , ( ) => {
260
275
const reportLines = stdout . split ( '\n' )
261
276
const finalLine = '19 problems (19 errors, 0 warnings)'
262
277
expect ( reportLines [ reportLines . length - 3 ] ) . to . contain ( finalLine )
263
-
264
- result = compareTextFiles ( currentFile , afterFixFile )
265
- expect ( result ) . to . be . true
266
278
} )
267
279
} )
280
+
268
281
it ( 'should check FOO1 does not change after test (4)' , ( ) => {
269
282
result = compareTextFiles ( currentFile , beforeFixFile )
270
283
expect ( result ) . to . be . true
271
284
} )
272
285
} )
273
286
274
- describe . only ( 'autofix rule: payable-fallback' , ( ) => {
275
- let code
276
- let stdout
277
-
287
+ describe ( 'autofix rule: payable-fallback' , ( ) => {
278
288
before ( function ( ) {
279
289
params = retrieveParams ( 'payable-fallback/' )
280
290
currentConfig = `${ params . path } ${ params . subpath } .solhint.json`
@@ -289,7 +299,7 @@ describe('e2e', function () {
289
299
}
290
300
} )
291
301
292
- xit ( 'should compare Foo1 file with template BEFORE FIX file and they should match (5)' , ( ) => {
302
+ it ( 'should compare Foo1 file with template BEFORE FIX file and they should match (5)' , ( ) => {
293
303
result = compareTextFiles ( currentFile , beforeFixFile )
294
304
expect ( result ) . to . be . true
295
305
} )
@@ -314,7 +324,7 @@ describe('e2e', function () {
314
324
} )
315
325
} )
316
326
317
- xit ( 'should check FOO1 does not change after test (5)' , ( ) => {
327
+ it ( 'should check FOO1 does not change after test (5)' , ( ) => {
318
328
result = compareTextFiles ( currentFile , beforeFixFile )
319
329
expect ( result ) . to . be . true
320
330
} )
0 commit comments