Skip to content

Commit b6c6d73

Browse files
author
dbale-altoros
committed
test: e2e not workin 7
1 parent c072707 commit b6c6d73

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

e2e/autofix-test.js

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ function retrieveParams(subpath) {
2525
function compareTextFiles(file1Path, file2Path) {
2626
const file1Content = fs.readFileSync(file1Path, 'utf-8')
2727
const file2Content = fs.readFileSync(file2Path, 'utf-8')
28-
console.log('file1Content :>> ', file1Content)
29-
console.log('file2Content :>> ', file2Content)
3028
return file1Content === file2Content
3129
}
3230

@@ -52,6 +50,8 @@ function useFixture(dir) {
5250

5351
describe('e2e', function () {
5452
let result = false
53+
let code
54+
let stdout
5555

5656
describe('autofix tests', () => {
5757
if (E2E) {
@@ -166,19 +166,23 @@ describe('e2e', function () {
166166
expect(result).to.be.true
167167
})
168168

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(
171171
`${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+
})
173177

178+
it('should execute and exit with code 1 (2)', () => {
174179
expect(code).to.equal(1)
180+
})
175181

182+
it('should get the right report (2)', () => {
176183
const reportLines = stdout.split('\n')
177184
const finalLine = '5 problems (5 errors, 0 warnings)'
178185
expect(reportLines[reportLines.length - 3]).to.contain(finalLine)
179-
180-
result = compareTextFiles(currentFile, afterFixFile)
181-
expect(result).to.be.true
182186
})
183187
})
184188

@@ -208,19 +212,23 @@ describe('e2e', function () {
208212
expect(result).to.be.true
209213
})
210214

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(
213217
`${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+
})
215223

224+
it('should execute and exit with code 1 (3)', () => {
216225
expect(code).to.equal(1)
226+
})
217227

228+
it('should get the right report (3)', () => {
218229
const reportLines = stdout.split('\n')
219230
const finalLine = '9 problems (9 errors, 0 warnings)'
220231
expect(reportLines[reportLines.length - 3]).to.contain(finalLine)
221-
222-
result = compareTextFiles(currentFile, afterFixFile)
223-
expect(result).to.be.true
224232
})
225233
})
226234

@@ -250,31 +258,33 @@ describe('e2e', function () {
250258
expect(result).to.be.true
251259
})
252260

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(
255263
`${params.command} ${params.param1} -c ${currentConfig} ${currentFile} --fix --disc --noPrompt`
256-
)
264+
))
257265

266+
result = compareTextFiles(currentFile, afterFixFile)
267+
expect(result).to.be.true
268+
})
269+
270+
it('should execute and exit with code 1 (4)', () => {
258271
expect(code).to.equal(1)
272+
})
259273

274+
it('should get the right report (4)', () => {
260275
const reportLines = stdout.split('\n')
261276
const finalLine = '19 problems (19 errors, 0 warnings)'
262277
expect(reportLines[reportLines.length - 3]).to.contain(finalLine)
263-
264-
result = compareTextFiles(currentFile, afterFixFile)
265-
expect(result).to.be.true
266278
})
267279
})
280+
268281
it('should check FOO1 does not change after test (4)', () => {
269282
result = compareTextFiles(currentFile, beforeFixFile)
270283
expect(result).to.be.true
271284
})
272285
})
273286

274-
describe.only('autofix rule: payable-fallback', () => {
275-
let code
276-
let stdout
277-
287+
describe('autofix rule: payable-fallback', () => {
278288
before(function () {
279289
params = retrieveParams('payable-fallback/')
280290
currentConfig = `${params.path}${params.subpath}.solhint.json`
@@ -289,7 +299,7 @@ describe('e2e', function () {
289299
}
290300
})
291301

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)', () => {
293303
result = compareTextFiles(currentFile, beforeFixFile)
294304
expect(result).to.be.true
295305
})
@@ -314,7 +324,7 @@ describe('e2e', function () {
314324
})
315325
})
316326

317-
xit('should check FOO1 does not change after test (5)', () => {
327+
it('should check FOO1 does not change after test (5)', () => {
318328
result = compareTextFiles(currentFile, beforeFixFile)
319329
expect(result).to.be.true
320330
})

0 commit comments

Comments
 (0)