diff --git a/assert/assert.test.ts b/assert/assert.test.ts index ed529b857d8..4a4e2db1598 100644 --- a/assert/assert.test.ts +++ b/assert/assert.test.ts @@ -32,6 +32,14 @@ namespace $ { 'three must be alike'() { $mol_assert_like( [ 3 ] , [ 3 ] , [ 3 ] ) } , + + 'two object must be alike'() { + $mol_assert_like( { a: 1 }, { a: 1 } ) + } , + + 'three object must be alike'() { + $mol_assert_like( { a: 1 }, { a: 1 }, { a: 1 } ) + } , } ) } diff --git a/assert/assert.ts b/assert/assert.ts index 6c2351a3c3c..89f5231bf83 100644 --- a/assert/assert.ts +++ b/assert/assert.ts @@ -116,7 +116,7 @@ namespace $ { if( 'outerHTML' in val ) return val.outerHTML try { - return JSON.stringify( val ) + return JSON.stringify( val, null, '\t' ) } catch( error: any ) { console.error( error ) return val diff --git a/assert/demo/demo.view.tree b/assert/demo/demo.view.tree index c2a9123f113..0db233edbe9 100644 --- a/assert/demo/demo.view.tree +++ b/assert/demo/demo.view.tree @@ -3,6 +3,7 @@ $mol_assert_demo $mol_example_code \$mol_assert_unique( 1 , 2 , 3 ) \$mol_assert_equal( 1 , 1 , 1 ) \$mol_assert_like( [1] , [1] , [1] ) + \$mol_assert_like( { a: 1 } , { a: 1 } , { a: 1 } ) aspects / \Algorithm/Assert \Testing