Page MenuHomePhabricator

D7754.id26276.diff
No OneTemporary

D7754.id26276.diff

diff --git a/lib/utils/objects.js b/lib/utils/objects.js
--- a/lib/utils/objects.js
+++ b/lib/utils/objects.js
@@ -2,7 +2,6 @@
import stableStringify from 'fast-json-stable-stringify';
import invariant from 'invariant';
-import _difference from 'lodash/fp/difference.js';
import _isEqual from 'lodash/fp/isEqual.js';
import _isPlainObject from 'lodash/fp/isPlainObject.js';
import stringHash from 'string-hash';
@@ -79,21 +78,19 @@
expectedObject: Map<K, T>,
message: string,
) {
- const processedObjectKeys = Object.keys(processedObject);
- const expectedObjectKeys = Object.keys(expectedObject);
-
- const inProcessedButNotExpected =
- _difference(processedObjectKeys)(expectedObjectKeys);
- const inExpectedButNotProcessed =
- _difference(expectedObjectKeys)(processedObjectKeys);
+ if (_isEqual(processedObject)(expectedObject)) {
+ return;
+ }
+ const dataProcessedButNotExpected = deepDiff(processedObject, expectedObject);
+ const dataExpectedButNotProcessed = deepDiff(expectedObject, processedObject);
invariant(
- _isEqual(processedObject)(expectedObject),
+ false,
`${message}: Objects should be equal.` +
- ` Object keys processed but not expected:` +
- ` ${inExpectedButNotProcessed.toString()}` +
- ` Object keys expected but not processed:` +
- ` ${inProcessedButNotExpected.toString()}`,
+ ` Data processed but not expected:` +
+ ` ${JSON.stringify(dataProcessedButNotExpected)}` +
+ ` Data expected but not processed:` +
+ ` ${JSON.stringify(dataExpectedButNotProcessed)}`,
);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:07 AM (1 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690530
Default Alt Text
D7754.id26276.diff (1 KB)

Event Timeline