@@ -50,20 +50,28 @@ describe('All of the compatible tests', () => {
5050 test ( `${ engine [ 1 ] } ${ JSON . stringify ( testCase . rule ) } ${ JSON . stringify (
5151 testCase . data
5252 ) } `, async ( ) => {
53- let result = await engine [ 0 ] . run ( testCase . rule , testCase . data )
54- if ( ( result || 0 ) . toNumber ) result = Number ( result )
55- if ( Array . isArray ( result ) ) result = result . map ( i => ( i || 0 ) . toNumber ? Number ( i ) : i )
56- expect ( correction ( result ) ) . toStrictEqual ( testCase . result )
53+ try {
54+ let result = await engine [ 0 ] . run ( testCase . rule , testCase . data )
55+ if ( ( result || 0 ) . toNumber ) result = Number ( result )
56+ if ( Array . isArray ( result ) ) result = result . map ( i => ( i || 0 ) . toNumber ? Number ( i ) : i )
57+ expect ( correction ( result ) ) . toStrictEqual ( testCase . result )
58+ } catch ( err ) {
59+ expect ( testCase . error ) . toStrictEqual ( true )
60+ }
5761 } )
5862
5963 test ( `${ engine [ 1 ] } ${ JSON . stringify ( testCase . rule ) } ${ JSON . stringify (
6064 testCase . data
6165 ) } (built)`, async ( ) => {
62- const f = await engine [ 0 ] . build ( testCase . rule )
63- let result = await f ( testCase . data )
64- if ( ( result || 0 ) . toNumber ) result = Number ( result )
65- if ( Array . isArray ( result ) ) result = result . map ( i => i . toNumber ? Number ( i ) : i )
66- expect ( correction ( result ) ) . toStrictEqual ( testCase . result )
66+ try {
67+ const f = await engine [ 0 ] . build ( testCase . rule )
68+ let result = await f ( testCase . data )
69+ if ( ( result || 0 ) . toNumber ) result = Number ( result )
70+ if ( Array . isArray ( result ) ) result = result . map ( i => i . toNumber ? Number ( i ) : i )
71+ expect ( correction ( result ) ) . toStrictEqual ( testCase . result )
72+ } catch ( err ) {
73+ expect ( testCase . error ) . toStrictEqual ( true )
74+ }
6775 } )
6876 }
6977 }
0 commit comments