Skip to content

Instantly share code, notes, and snippets.

@tluyben

tluyben/assert.js

Created Nov 27, 2020
Embed
What would you like to do?
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