mol_tree2 1.0.821 → 1.0.823

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
@@ -3027,9 +3027,10 @@ var $;
3027
3027
  return right_cache;
3028
3028
  }
3029
3029
  else {
3030
- left_cache = new WeakMap([[right, true]]);
3030
+ left_cache = new WeakMap();
3031
3031
  $.$mol_compare_deep_cache.set(left, left_cache);
3032
3032
  }
3033
+ left_cache.set(right, true);
3033
3034
  let result;
3034
3035
  try {
3035
3036
  if (!left_proto)
@@ -3181,6 +3182,20 @@ var $;
3181
3182
  b['self'] = b;
3182
3183
  $mol_assert_ok($mol_compare_deep(a, b));
3183
3184
  },
3185
+ 'same POJOs with cyclic reference with cache warmup'() {
3186
+ const obj1 = { test: 1, obj3: null };
3187
+ const obj1_copy = { test: 1, obj3: null };
3188
+ const obj2 = { test: 2, obj1 };
3189
+ const obj2_copy = { test: 2, obj1: obj1_copy };
3190
+ const obj3 = { test: 3, obj2 };
3191
+ const obj3_copy = { test: 3, obj2: obj2_copy };
3192
+ obj1.obj3 = obj3;
3193
+ obj1_copy.obj3 = obj3_copy;
3194
+ $mol_assert_not($mol_compare_deep(obj1, {}));
3195
+ $mol_assert_not($mol_compare_deep(obj2, {}));
3196
+ $mol_assert_not($mol_compare_deep(obj3, {}));
3197
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
3198
+ },
3184
3199
  'Date'() {
3185
3200
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
3186
3201
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));