Skip to content

Instantly share code, notes, and snippets.

@tluyben
Created November 27, 2020 07:06
Show Gist options
  • Save tluyben/c4de33efc28c30faf2e4a1c42ef041d9 to your computer and use it in GitHub Desktop.
Save tluyben/c4de33efc28c30faf2e4a1c42ef041d9 to your computer and use it in GitHub Desktop.
partial deep assert
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