@@ -8,8 +8,8 @@ const files = fs.readdirSync('./suites')
88for ( const file of files ) {
99 if ( file . endsWith ( '.json' ) ) {
1010 tests . push ( ...JSON . parse ( fs . readFileSync ( `./suites/${ file } ` ) . toString ( ) ) . filter ( i => typeof i !== 'string' ) . map ( i => {
11- if ( Array . isArray ( i ) ) return i
12- return [ i . rule , i . data || { } , i . result ]
11+ if ( Array . isArray ( i ) ) return { rule : i [ 0 ] , data : i [ 1 ] || null , result : i [ 2 ] , description : JSON . stringify ( i [ 0 ] ) }
12+ return i
1313 } ) )
1414 }
1515}
@@ -47,23 +47,23 @@ for (let i = 0; i < 8; i++) {
4747describe ( 'All of the compatible tests' , ( ) => {
4848 for ( const testCase of tests ) {
4949 for ( const engine of engines ) {
50- test ( `${ engine [ 1 ] } ${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
51- testCase [ 1 ]
50+ test ( `${ engine [ 1 ] } ${ JSON . stringify ( testCase . rule ) } ${ JSON . stringify (
51+ testCase . data
5252 ) } `, async ( ) => {
53- let result = await engine [ 0 ] . run ( testCase [ 0 ] , testCase [ 1 ] )
53+ let result = await engine [ 0 ] . run ( testCase . rule , testCase . data )
5454 if ( ( result || 0 ) . toNumber ) result = Number ( result )
5555 if ( Array . isArray ( result ) ) result = result . map ( i => ( i || 0 ) . toNumber ? Number ( i ) : i )
56- expect ( correction ( result ) ) . toStrictEqual ( testCase [ 2 ] )
56+ expect ( correction ( result ) ) . toStrictEqual ( testCase . result )
5757 } )
5858
59- test ( `${ engine [ 1 ] } ${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
60- testCase [ 1 ]
59+ test ( `${ engine [ 1 ] } ${ JSON . stringify ( testCase . rule ) } ${ JSON . stringify (
60+ testCase . data
6161 ) } (built)`, async ( ) => {
62- const f = await engine [ 0 ] . build ( testCase [ 0 ] )
63- let result = await f ( testCase [ 1 ] )
62+ const f = await engine [ 0 ] . build ( testCase . rule )
63+ let result = await f ( testCase . data )
6464 if ( ( result || 0 ) . toNumber ) result = Number ( result )
6565 if ( Array . isArray ( result ) ) result = result . map ( i => i . toNumber ? Number ( i ) : i )
66- expect ( correction ( result ) ) . toStrictEqual ( testCase [ 2 ] )
66+ expect ( correction ( result ) ) . toStrictEqual ( testCase . result )
6767 } )
6868 }
6969 }
0 commit comments