mol_wire_lib 1.0.1144 → 1.0.1145

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.mjs CHANGED
@@ -873,9 +873,10 @@ var $;
873
873
  return right_cache;
874
874
  }
875
875
  else {
876
- left_cache = new WeakMap([[right, true]]);
876
+ left_cache = new WeakMap();
877
877
  $.$mol_compare_deep_cache.set(left, left_cache);
878
878
  }
879
+ left_cache.set(right, true);
879
880
  let result;
880
881
  try {
881
882
  if (!left_proto)
package/node.test.js CHANGED
@@ -864,9 +864,10 @@ var $;
864
864
  return right_cache;
865
865
  }
866
866
  else {
867
- left_cache = new WeakMap([[right, true]]);
867
+ left_cache = new WeakMap();
868
868
  $.$mol_compare_deep_cache.set(left, left_cache);
869
869
  }
870
+ left_cache.set(right, true);
870
871
  let result;
871
872
  try {
872
873
  if (!left_proto)
@@ -3288,6 +3289,20 @@ var $;
3288
3289
  b['self'] = b;
3289
3290
  $mol_assert_ok($mol_compare_deep(a, b));
3290
3291
  },
3292
+ 'same POJOs with cyclic reference with cache warmup'() {
3293
+ const obj1 = { test: 1, obj3: null };
3294
+ const obj1_copy = { test: 1, obj3: null };
3295
+ const obj2 = { test: 2, obj1 };
3296
+ const obj2_copy = { test: 2, obj1: obj1_copy };
3297
+ const obj3 = { test: 3, obj2 };
3298
+ const obj3_copy = { test: 3, obj2: obj2_copy };
3299
+ obj1.obj3 = obj3;
3300
+ obj1_copy.obj3 = obj3_copy;
3301
+ $mol_assert_not($mol_compare_deep(obj1, {}));
3302
+ $mol_assert_not($mol_compare_deep(obj2, {}));
3303
+ $mol_assert_not($mol_compare_deep(obj3, {}));
3304
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
3305
+ },
3291
3306
  'Date'() {
3292
3307
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
3293
3308
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));