Page MenuHomePhabricator

D7754.diff
No OneTemporary

D7754.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';
@@ -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

Mime Type
text/plain
Expires
Thu, Dec 5, 7:07 AM (15 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2616329
Default Alt Text
D7754.diff (1 KB)

Event Timeline