Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript test cases

// if you're using nodejs
import { strict as assert } from 'assert';
assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
// AssertionError: Expected inputs to be strictly deep-equal:
// + actual - expected ... Lines skipped
//
//   [
//     [
// ...
//       2,
// +     3
// -     '3'
//     ],
// ...
//     5
//   ]

// if you're using js in frontend
// you could make something like this
const assert = {}
assert.deepEqual = function(actual, expected) {
	if(actual !== expected) throw new Error("AssertionError: Expected inputs to be strictly deep-equal");
	return actual === expected;
} 

assert.deepEqual(2, 2);
 
PREVIOUS NEXT
Tagged: #javascript #test #cases
ADD COMMENT
Topic
Name
2+6 =