Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509658
D7754.id26276.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7754.id26276.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 7:07 AM (6 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690530
Default Alt Text
D7754.id26276.diff (1 KB)
Attached To
Mode
D7754: [lib] modify `assertObjectsAreEqual` to return deep differential instead of only one level keys
Attached
Detach File
Event Timeline
Log In to Comment