mol_dump_lib 0.0.456 → 0.0.458

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
@@ -984,9 +984,10 @@ var $;
984
984
  return right_cache;
985
985
  }
986
986
  else {
987
- left_cache = new WeakMap([[right, true]]);
987
+ left_cache = new WeakMap();
988
988
  $.$mol_compare_deep_cache.set(left, left_cache);
989
989
  }
990
+ left_cache.set(right, true);
990
991
  let result;
991
992
  try {
992
993
  if (!left_proto)
package/node.test.js CHANGED
@@ -975,9 +975,10 @@ var $;
975
975
  return right_cache;
976
976
  }
977
977
  else {
978
- left_cache = new WeakMap([[right, true]]);
978
+ left_cache = new WeakMap();
979
979
  $.$mol_compare_deep_cache.set(left, left_cache);
980
980
  }
981
+ left_cache.set(right, true);
981
982
  let result;
982
983
  try {
983
984
  if (!left_proto)
@@ -7149,6 +7150,20 @@ var $;
7149
7150
  b['self'] = b;
7150
7151
  $mol_assert_ok($mol_compare_deep(a, b));
7151
7152
  },
7153
+ 'same POJOs with cyclic reference with cache warmup'() {
7154
+ const obj1 = { test: 1, obj3: null };
7155
+ const obj1_copy = { test: 1, obj3: null };
7156
+ const obj2 = { test: 2, obj1 };
7157
+ const obj2_copy = { test: 2, obj1: obj1_copy };
7158
+ const obj3 = { test: 3, obj2 };
7159
+ const obj3_copy = { test: 3, obj2: obj2_copy };
7160
+ obj1.obj3 = obj3;
7161
+ obj1_copy.obj3 = obj3_copy;
7162
+ $mol_assert_not($mol_compare_deep(obj1, {}));
7163
+ $mol_assert_not($mol_compare_deep(obj2, {}));
7164
+ $mol_assert_not($mol_compare_deep(obj3, {}));
7165
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
7166
+ },
7152
7167
  'Date'() {
7153
7168
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
7154
7169
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));