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/web.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/web.test.js CHANGED
@@ -728,6 +728,20 @@ var $;
728
728
  b['self'] = b;
729
729
  $mol_assert_ok($mol_compare_deep(a, b));
730
730
  },
731
+ 'same POJOs with cyclic reference with cache warmup'() {
732
+ const obj1 = { test: 1, obj3: null };
733
+ const obj1_copy = { test: 1, obj3: null };
734
+ const obj2 = { test: 2, obj1 };
735
+ const obj2_copy = { test: 2, obj1: obj1_copy };
736
+ const obj3 = { test: 3, obj2 };
737
+ const obj3_copy = { test: 3, obj2: obj2_copy };
738
+ obj1.obj3 = obj3;
739
+ obj1_copy.obj3 = obj3_copy;
740
+ $mol_assert_not($mol_compare_deep(obj1, {}));
741
+ $mol_assert_not($mol_compare_deep(obj2, {}));
742
+ $mol_assert_not($mol_compare_deep(obj3, {}));
743
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
744
+ },
731
745
  'Date'() {
732
746
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
733
747
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));