mol_mutable 0.0.652 → 0.0.654

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
@@ -1071,9 +1071,10 @@ var $;
1071
1071
  return right_cache;
1072
1072
  }
1073
1073
  else {
1074
- left_cache = new WeakMap([[right, true]]);
1074
+ left_cache = new WeakMap();
1075
1075
  $.$mol_compare_deep_cache.set(left, left_cache);
1076
1076
  }
1077
+ left_cache.set(right, true);
1077
1078
  let result;
1078
1079
  try {
1079
1080
  if (!left_proto)
@@ -1225,6 +1226,20 @@ var $;
1225
1226
  b['self'] = b;
1226
1227
  $mol_assert_ok($mol_compare_deep(a, b));
1227
1228
  },
1229
+ 'same POJOs with cyclic reference with cache warmup'() {
1230
+ const obj1 = { test: 1, obj3: null };
1231
+ const obj1_copy = { test: 1, obj3: null };
1232
+ const obj2 = { test: 2, obj1 };
1233
+ const obj2_copy = { test: 2, obj1: obj1_copy };
1234
+ const obj3 = { test: 3, obj2 };
1235
+ const obj3_copy = { test: 3, obj2: obj2_copy };
1236
+ obj1.obj3 = obj3;
1237
+ obj1_copy.obj3 = obj3_copy;
1238
+ $mol_assert_not($mol_compare_deep(obj1, {}));
1239
+ $mol_assert_not($mol_compare_deep(obj2, {}));
1240
+ $mol_assert_not($mol_compare_deep(obj3, {}));
1241
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
1242
+ },
1228
1243
  'Date'() {
1229
1244
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
1230
1245
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));