node-tdd 5.2.0 → 5.2.2
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.
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import objectScan from 'object-scan';
|
|
2
2
|
import cloneDeep from 'lodash.clonedeep';
|
|
3
3
|
|
|
4
|
-
const last = (arr) => arr[arr.length - 1];
|
|
5
|
-
|
|
6
4
|
const healer = objectScan(['**.*|*'], {
|
|
7
5
|
breakFn: ({
|
|
8
6
|
isMatch, depth, property, context
|
|
@@ -10,8 +8,8 @@ const healer = objectScan(['**.*|*'], {
|
|
|
10
8
|
if (property === undefined) {
|
|
11
9
|
return false;
|
|
12
10
|
}
|
|
13
|
-
context.expected[depth] =
|
|
14
|
-
context.actual[depth] =
|
|
11
|
+
context.expected[depth] = context.expected[depth - 1]?.[property];
|
|
12
|
+
context.actual[depth] = context.actual[depth - 1]?.[property];
|
|
15
13
|
return isMatch;
|
|
16
14
|
},
|
|
17
15
|
filterFn: ({
|
|
@@ -22,12 +20,7 @@ const healer = objectScan(['**.*|*'], {
|
|
|
22
20
|
const parentActual = context.actual[depth - 1];
|
|
23
21
|
const childExpected = parentExpected?.[k];
|
|
24
22
|
const childActual = parentActual?.[k];
|
|
25
|
-
if (
|
|
26
|
-
parentActual !== undefined
|
|
27
|
-
&& !(childExpected instanceof Object)
|
|
28
|
-
&& !(childActual instanceof Object)
|
|
29
|
-
&& childExpected === childActual
|
|
30
|
-
) {
|
|
23
|
+
if (childExpected === childActual) {
|
|
31
24
|
delete parentActual[k];
|
|
32
25
|
parentActual[property] = value;
|
|
33
26
|
}
|