Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3409112
D7754.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.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';
@@ -101,21 +100,19 @@
expectedObject: ObjectMap<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
Thu, Dec 5, 3:01 PM (12 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2616329
Default Alt Text
D7754.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