mol_regexp 0.0.1270 → 0.0.1272

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.test.js CHANGED
@@ -1336,9 +1336,10 @@ var $;
1336
1336
  return right_cache;
1337
1337
  }
1338
1338
  else {
1339
- left_cache = new WeakMap([[right, true]]);
1339
+ left_cache = new WeakMap();
1340
1340
  $.$mol_compare_deep_cache.set(left, left_cache);
1341
1341
  }
1342
+ left_cache.set(right, true);
1342
1343
  let result;
1343
1344
  try {
1344
1345
  if (!left_proto)
@@ -1490,6 +1491,20 @@ var $;
1490
1491
  b['self'] = b;
1491
1492
  $mol_assert_ok($mol_compare_deep(a, b));
1492
1493
  },
1494
+ 'same POJOs with cyclic reference with cache warmup'() {
1495
+ const obj1 = { test: 1, obj3: null };
1496
+ const obj1_copy = { test: 1, obj3: null };
1497
+ const obj2 = { test: 2, obj1 };
1498
+ const obj2_copy = { test: 2, obj1: obj1_copy };
1499
+ const obj3 = { test: 3, obj2 };
1500
+ const obj3_copy = { test: 3, obj2: obj2_copy };
1501
+ obj1.obj3 = obj3;
1502
+ obj1_copy.obj3 = obj3_copy;
1503
+ $mol_assert_not($mol_compare_deep(obj1, {}));
1504
+ $mol_assert_not($mol_compare_deep(obj2, {}));
1505
+ $mol_assert_not($mol_compare_deep(obj3, {}));
1506
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
1507
+ },
1493
1508
  'Date'() {
1494
1509
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
1495
1510
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));