File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1+ function assertEqual ( actual , expected , message ) {
2+ if ( actual !== expected ) {
3+ message = ( ( typeof message != "undefined" ) ? message + " " :"" ) + "Assertion failed. Expected " + ( ( typeof expected == "string" ) ?"\"" :"" ) + expected + ( ( typeof expected == "string" ) ?"\"" :"" ) + " instead got " + ( ( typeof actual == "string" ) ?"\"" :"" ) + actual + ( ( typeof actual == "string" ) ?"\"" :"" ) ;
4+ console . error ( message ) ;
5+ } else console . log ( "%cTest passed. " + ( ( typeof actual == "string" ) ?"\"" :"" ) + actual + ( ( typeof actual == "string" ) ?"\"" :"" ) + " === " + ( ( typeof expected == "string" ) ?"\"" :"" ) + expected + ( ( typeof expected == "string" ) ?"\"" :"" ) , "color: green;" ) ;
6+ }
7+
8+ function assertDeepEqual ( actual , expected , message ) {
9+ if ( JSON . stringify ( actual ) !== JSON . stringify ( expected ) ) {
10+ message = ( ( typeof message != "undefined" ) ? message + " " :"" ) + "Assertion failed. Expected " + ( ( typeof expected == "string" ) ?"\"" :"" ) + JSON . stringify ( expected ) + ( ( typeof expected == "string" ) ?"\"" :"" ) + " instead got " + ( ( typeof actual == "string" ) ?"\"" :"" ) + JSON . stringify ( actual ) + ( ( typeof actual == "string" ) ?"\"" :"" ) ;
11+ console . error ( message ) ;
12+ } else console . log ( "%cTest passed. " + ( ( typeof actual == "string" ) ?"\"" :"" ) + JSON . stringify ( actual ) + ( ( typeof actual == "string" ) ?"\"" :"" ) + " === " + ( ( typeof expected == "string" ) ?"\"" :"" ) + JSON . stringify ( expected ) + ( ( typeof expected == "string" ) ?"\"" :"" ) , "color: green;" ) ;
13+ }
You can’t perform that action at this time.
0 commit comments