[DEV-3836] make tests recursive

master
Joseph Frazer 2018-10-22 10:59:03 -04:00
parent f5913d6fa0
commit ac00ce4401
2 changed files with 13 additions and 4 deletions

View File

@ -192,7 +192,7 @@ module.exports = Class( 'TestRunner',
{
return Array.isArray( y )
&& ( x.length === y.length )
&& x.every( ( xval, i ) => xval === y[ i ] );
&& x.every( ( xval, i ) => this._deepCompare( xval, y[ i ] ) );
}
// scalar

View File

@ -56,6 +56,11 @@ describe( "TestRunner", () =>
baz: [ 4, 2 ],
},
},
{
description: "recursive",
data: { a: [[[[1]]]] },
expect: { foo: [[[[1]]]] },
},
];
const rate_results = [
@ -68,6 +73,10 @@ describe( "TestRunner", () =>
bar: [ 3, 4 ],
baz: [ 4, 5 ],
} },
// no failures
{ vars: {
foo: [[[[1]]]],
} },
];
const expect_failures = [
@ -83,10 +92,11 @@ describe( "TestRunner", () =>
expect: test_cases[ 1 ].expect.baz,
result: rate_results[ 1 ].vars.baz,
},
]
],
[],
];
Sut( NullTestReporter(), program )
return Sut( NullTestReporter(), program )
.runTests( test_cases )
.then( results =>
{
@ -95,7 +105,6 @@ describe( "TestRunner", () =>
const result = results[ i ];
expect( result.desc ).to.equal( test_case.description );
expect( result.i ).to.equal( i );
expect( result.total ).to.equal(
Object.keys( test_case.expect ).length
);