Skip to content

Commit ecc7d6a

Browse files
committed
fix: clean up assertion (shorten)
1 parent 3be2656 commit ecc7d6a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/e2e/terminal.test.ts

+6-11
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,12 @@ test.describe("Integrated Terminal", () => {
4646
await page.keyboard.press("Enter")
4747
await page.waitForTimeout(2000)
4848

49-
let fileExists = false
50-
51-
try {
52-
// Check that the file exists
53-
await fs.promises.access(tmpFile, fs.constants.F_OK)
54-
fileExists = true
55-
} catch (error) {
56-
console.error("Could not find file")
57-
}
58-
59-
expect(fileExists).toBe(true)
49+
// .access checks if the file exists without opening it
50+
// it doesn't return anything hence why we expect it to
51+
// resolve to undefined
52+
// If the promise rejects (i.e. the file doesn't exist)
53+
// then the assertion will fail
54+
expect(fs.promises.access(tmpFile)).resolves.toBeUndefined()
6055

6156
// TODO delete tmpFolder
6257
})

0 commit comments

Comments
 (0)