Skip to content

Commit

Permalink
fix tests path manip following Chris\' suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
bpinsard committed Jan 6, 2025
1 parent 9e073fa commit 79b6466
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/validators/filenameIdentify.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assertEquals } from '@std/assert'
import { SEPARATOR_PATTERN } from '@std/path'
import { BIDSContext } from '../schema/context.ts'
import { _findRuleMatches, datatypeFromDirectory, hasMatch } from './filenameIdentify.ts'
import { BIDSFileDeno } from '../files/deno.ts'
Expand Down Expand Up @@ -67,12 +68,8 @@ Deno.test('test hasMatch', async (t) => {

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

const context = new BIDSContext(file)
await hasMatch(schema, context)
Expand All @@ -82,7 +79,6 @@ Deno.test('test hasMatch', async (t) => {
code: 'NOT_INCLUDED',
}).length,
1,
`${context.file.path} ${tmpFile}`
)
Deno.removeSync(tmpFile)
})
Expand Down

0 comments on commit 79b6466

Please sign in to comment.