@@ -2,6 +2,7 @@ import { assert, assertEquals } from '@std/assert'
22import { filenameIdentify } from './filenameIdentify.ts'
33import { filenameValidate } from './filenameValidate.ts'
44import { BIDSContext , BIDSContextDataset } from '../schema/context.ts'
5+ import { makeBIDSContext } from '../schema/context.test.ts'
56import { loadSchema } from '../setup/loadSchema.ts'
67import type { GenericSchema , Schema } from '../types/schema.ts'
78import type { DatasetIssues } from '../issues/datasetIssues.ts'
@@ -11,12 +12,12 @@ import { StringOpener } from '../files/openers.test.ts'
1112
1213const schema = await loadSchema ( )
1314
14- function makeContext ( path : string , contents : string = '' ) : BIDSContext {
15+ async function makeContext ( path : string , contents : string = '' ) : Promise < BIDSContext > {
1516 const tree = pathsToTree ( [ path ] )
1617 const dataset = new BIDSContextDataset ( { schema, tree } )
1718 const file = tree . get ( path ) as BIDSFile
1819 file . opener = new StringOpener ( contents )
19- return new BIDSContext ( file , dataset )
20+ return makeBIDSContext ( file , dataset )
2021}
2122
2223Deno . test ( 'test valid paths' , async ( t ) => {
@@ -57,7 +58,7 @@ Deno.test('test valid paths', async (t) => {
5758 ]
5859 for ( const filename of validFiles ) {
5960 await t . step ( filename , async ( ) => {
60- const context = makeContext ( filename )
61+ const context = await makeContext ( filename , '{"valid": "json"}' )
6162 await filenameIdentify ( schema , context )
6263 await filenameValidate ( schema as unknown as GenericSchema , context )
6364 assertEquals (
@@ -116,7 +117,7 @@ Deno.test('test invalid paths', async (t) => {
116117 ]
117118 for ( const filename of invalidFiles ) {
118119 await t . step ( filename , async ( ) => {
119- const context = makeContext ( filename )
120+ const context = await makeContext ( filename )
120121 await filenameIdentify ( schema , context )
121122 await filenameValidate ( schema as unknown as GenericSchema , context )
122123 assert (
0 commit comments