mol_text_distance 0.0.918 → 0.0.920

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
@@ -1088,9 +1088,10 @@ var $;
1088
1088
  return right_cache;
1089
1089
  }
1090
1090
  else {
1091
- left_cache = new WeakMap([[right, true]]);
1091
+ left_cache = new WeakMap();
1092
1092
  $.$mol_compare_deep_cache.set(left, left_cache);
1093
1093
  }
1094
+ left_cache.set(right, true);
1094
1095
  let result;
1095
1096
  try {
1096
1097
  if (!left_proto)
@@ -1242,6 +1243,20 @@ var $;
1242
1243
  b['self'] = b;
1243
1244
  $mol_assert_ok($mol_compare_deep(a, b));
1244
1245
  },
1246
+ 'same POJOs with cyclic reference with cache warmup'() {
1247
+ const obj1 = { test: 1, obj3: null };
1248
+ const obj1_copy = { test: 1, obj3: null };
1249
+ const obj2 = { test: 2, obj1 };
1250
+ const obj2_copy = { test: 2, obj1: obj1_copy };
1251
+ const obj3 = { test: 3, obj2 };
1252
+ const obj3_copy = { test: 3, obj2: obj2_copy };
1253
+ obj1.obj3 = obj3;
1254
+ obj1_copy.obj3 = obj3_copy;
1255
+ $mol_assert_not($mol_compare_deep(obj1, {}));
1256
+ $mol_assert_not($mol_compare_deep(obj2, {}));
1257
+ $mol_assert_not($mol_compare_deep(obj3, {}));
1258
+ $mol_assert_ok($mol_compare_deep(obj3, obj3_copy));
1259
+ },
1245
1260
  'Date'() {
1246
1261
  $mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
1247
1262
  $mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));