@@ -37,10 +37,10 @@ const getTestCaseBase = async (names: string[], languages: string[]): Promise<Te
37
37
const testCases : TestCase [ ] = [ ] ;
38
38
39
39
languages . forEach ( ( language ) => {
40
- if ( language !== "ts" ) { return ; }
40
+ // if (language !== "ts") { return; }
41
41
42
42
names . forEach ( ( name ) => {
43
- if ( name !== "json-schema " ) { return ; }
43
+ // if (name !== "boolean-schemas ") { return; }
44
44
45
45
promises . push ( readFile ( `${ testCaseDir } /${ name } .json` , "utf8" )
46
46
. then ( ( fileContents ) => {
@@ -69,14 +69,21 @@ const addExpectedTypings = async (tcs: TestCase[]): Promise<TestCase[]> => {
69
69
} ;
70
70
71
71
const 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
+ } ) ) ;
78
82
79
- await Promise . all ( derefPromises ) ;
83
+ if ( wasArray === false ) {
84
+ tc . schema = tc . schema [ 0 ] ;
85
+ }
86
+ }
80
87
81
88
return tcs ;
82
89
} ;
0 commit comments