@@ -37,10 +37,10 @@ const getTestCaseBase = async (names: string[], languages: string[]): Promise<Te
3737 const testCases : TestCase [ ] = [ ] ;
3838
3939 languages . forEach ( ( language ) => {
40- if ( language !== "ts" ) { return ; }
40+ // if (language !== "ts") { return; }
4141
4242 names . forEach ( ( name ) => {
43- if ( name !== "json-schema " ) { return ; }
43+ // if (name !== "boolean-schemas ") { return; }
4444
4545 promises . push ( readFile ( `${ testCaseDir } /${ name } .json` , "utf8" )
4646 . then ( ( fileContents ) => {
@@ -69,14 +69,21 @@ const addExpectedTypings = async (tcs: TestCase[]): Promise<TestCase[]> => {
6969} ;
7070
7171const derefTestCases = async ( tcs : TestCase [ ] ) : Promise < TestCase [ ] > => {
72- const derefPromises : any [ ] = [ ] ;
73-
74- tcs . forEach ( ( tc ) => {
75- const dereffer = new Dereferencer ( tc . schema ) ;
76- derefPromises . push ( dereffer . resolve ( ) . then ( ( s ) => tc . schema = s ) ) ;
77- } ) ;
72+ for ( const tc of tcs ) {
73+ let s = tc . schema as JSONSchema [ ] ;
74+ const wasArray = tc . schema instanceof Array ;
75+ if ( wasArray === false ) {
76+ s = [ s ] ;
77+ }
78+ tc . schema = await Promise . all ( s . map ( ( _s ) => {
79+ const dereffer = new Dereferencer ( _s ) ;
80+ return dereffer . resolve ( ) ;
81+ } ) ) ;
7882
79- await Promise . all ( derefPromises ) ;
83+ if ( wasArray === false ) {
84+ tc . schema = tc . schema [ 0 ] ;
85+ }
86+ }
8087
8188 return tcs ;
8289} ;
0 commit comments