Created
November 27, 2020 07:06
-
-
Save tluyben/c4de33efc28c30faf2e4a1c42ef041d9 to your computer and use it in GitHub Desktop.
partial deep assert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const processOutput = (_output, _outputExample) => { | |
| Object.keys(_outputExample).forEach((k)=>{ | |
| const val = _outputExample[k] | |
| if (val != null && Array.isArray(val)) { | |
| assert.deepStrictEqual(_output[k], val) | |
| } else if (typeof val == 'object' && val != null) { | |
| processOutput(_output[k], val) | |
| } else { | |
| assert.strictEqual(_output[k], val) | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment