mol_crypto_lib 0.1.1252 → 0.1.1254

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
@@ -2239,9 +2239,10 @@ var $;
2239
2239
  return right_cache;
2240
2240
  }
2241
2241
  else {
2242
- left_cache = new WeakMap([[right, true]]);
2242
+ left_cache = new WeakMap();
2243
2243
  $.$mol_compare_deep_cache.set(left, left_cache);
2244
2244
  }
2245
+ left_cache.set(right, true);
2245
2246
  let result;
2246
2247
  try {
2247
2248
  if (!left_proto)
@@ -2393,6 +2394,20 @@ var $;
2393
2394
  b['self'] = b;
2394
2395
  $mol_assert_ok($mol_compare_deep(a, b));
2395
2396
  },
2397
+ 'same POJOs with cyclic reference with cache warmup'() {
2398
+ const obj1 = { test: 1, obj3: null };
2399
+ const obj1_copy = { test: 1, obj3: null };
2400
+ const obj2 = { test: 2, obj1 };
2401
+ const obj2_copy = { test: 2, obj1: obj1_copy };
2402
+ const obj3 = { test: 3, obj2 };
2403
+ const obj3_copy = { test: 3, obj2: obj2_copy };
2404
+ obj1.obj3 = obj3;
2405
+ obj1_copy.obj3 = obj3_copy;
2406
+ $mol_assert_not($mol_compare_deep(obj1, {}));
2407
+ $mol_assert_not($mol_compare_deep(obj2, {}));
2408
+ $mol_assert_not($mol_compare_deep(obj3, {}));
2409
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
2410
+ },
2396
2411
  'Date'() {
2397
2412
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
2398
2413
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));