( processedObject: ObjectMap<K, T>, expectedObject: ObjectMap<K, T>, message: string, )
| 102 | } |
| 103 | |
| 104 | function assertObjectsAreEqual<K, T>( |
| 105 | processedObject: ObjectMap<K, T>, |
| 106 | expectedObject: ObjectMap<K, T>, |
| 107 | message: string, |
| 108 | ): void { |
| 109 | if (_isEqual(processedObject)(expectedObject)) { |
| 110 | return; |
| 111 | } |
| 112 | const dataProcessedButNotExpected = deepDiff(processedObject, expectedObject); |
| 113 | const dataExpectedButNotProcessed = deepDiff(expectedObject, processedObject); |
| 114 | |
| 115 | throw new Error( |
| 116 | `${message}: Objects should be equal.` + |
| 117 | ` Data processed but not expected:` + |
| 118 | ` ${JSON.stringify(dataProcessedButNotExpected)}` + |
| 119 | ` Data expected but not processed:` + |
| 120 | ` ${JSON.stringify(dataExpectedButNotProcessed)}`, |
| 121 | ); |
| 122 | } |
| 123 | |
| 124 | function invertObjectToMap<K, V>(obj: { +[K]: V }): Map<V, K> { |
| 125 | const invertedMap = new Map<V, K>(); |
nothing calls this directly
no test coverage detected