source: trip-planner-front/node_modules/deep-equal/test/_tape.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 974 bytes
RevLine 
[6a3a178]1var Test = require('tape/lib/test');
2var is = require('object-is');
3var equal = require('../');
4
5function equalReversed(t, a, b, isEqual, msg, isStrict, skipReversed) {
6 var actual = isStrict ? equal(a, b, { strict: true }) : equal(a, b);
7 var suffix = isEqual ? ' are equal' : ' are not equal';
8 t.equal(actual, !!isEqual, msg + suffix);
9 if (typeof skipReversed === 'boolean' ? !skipReversed : !is(a, b)) {
10 var actualReverse = isStrict ? equal(b, a, { strict: true }) : equal(b, a);
11 t.equal(actualReverse, !!isEqual, msg + suffix + ' (reversed)');
12 }
13}
14function deepEqualTest(t, a, b, msg, isEqual, isStrictEqual, skipReversed) {
15 equalReversed(t, a, b, isEqual, msg, false, skipReversed);
16 equalReversed(t, a, b, isStrictEqual, 'strict: ' + msg, true, skipReversed);
17}
18
19Test.prototype.deepEqualTest = function (a, b, message, isEqual, isStrictEqual, skipReversed) {
20 return deepEqualTest(this, a, b, message, !!isEqual, !!isStrictEqual, skipReversed);
21};
Note: See TracBrowser for help on using the repository browser.