Skip to content

Commit 79b6466

Browse files
committed
fix tests path manip following Chris\' suggestions.
1 parent 9e073fa commit 79b6466

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/validators/filenameIdentify.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { assertEquals } from '@std/assert'
2+
import { SEPARATOR_PATTERN } from '@std/path'
23
import { BIDSContext } from '../schema/context.ts'
34
import { _findRuleMatches, datatypeFromDirectory, hasMatch } from './filenameIdentify.ts'
45
import { BIDSFileDeno } from '../files/deno.ts'
@@ -67,12 +68,8 @@ Deno.test('test hasMatch', async (t) => {
6768

6869
await t.step('No match', async () => {
6970
const tmpFile = Deno.makeTempFileSync()
70-
const parts = tmpFile.split('/')
71-
const file = new BIDSFileDeno(
72-
parts.slice(0, parts.length - 1).join('/'),
73-
'/' + parts[parts.length - 1],
74-
ignore,
75-
)
71+
const [ dir, base ] = tmpFile.split(SEPARATOR_PATTERN)
72+
const file = new BIDSFileDeno(dir, `/${base}`, ignore)
7673

7774
const context = new BIDSContext(file)
7875
await hasMatch(schema, context)
@@ -82,7 +79,6 @@ Deno.test('test hasMatch', async (t) => {
8279
code: 'NOT_INCLUDED',
8380
}).length,
8481
1,
85-
`${context.file.path} ${tmpFile}`
8682
)
8783
Deno.removeSync(tmpFile)
8884
})

0 commit comments

Comments
 (0)