Skip to content

Commit 4dbb4b0

Browse files
committed
fix potential test error
1 parent 9511752 commit 4dbb4b0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/index.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ await describe('windows-unc-path-connect', async () => {
2626
disconnectUncPath(path.uncPath)
2727

2828
// Reading files should fail
29+
let canReadFiles = false
30+
2931
try {
3032
await fs.readdir(path.uncPath)
33+
canReadFiles = true
34+
} catch {}
35+
36+
if (canReadFiles) {
3137
assert.fail('Reading directory successful after deleting path.')
32-
} catch {
33-
assert.ok(true)
3438
}
3539

3640
// Connect to share
@@ -58,7 +62,7 @@ await describe('windows-unc-path-connect/validators', async () => {
5862
'\\192.168.1.1', // missing double slash beginning
5963
'\\\\192.168.1.1\\folder" /delete' // includes double quote
6064
]
61-
65+
6266
await describe('uncPathIsSafe()', async () => {
6367
await it('Returns "true" for good UNC paths', () => {
6468
for (const goodUncPath of goodUncPaths) {
@@ -67,7 +71,6 @@ await describe('windows-unc-path-connect/validators', async () => {
6771
})
6872

6973
await it('Returns "false" for bad UNC paths', () => {
70-
7174
for (const badUncPath of badUncPaths) {
7275
assert.strictEqual(uncPathIsSafe(badUncPath), false)
7376

0 commit comments

Comments
 (0)