Created
May 28, 2021 18:29
-
-
Save sergueyarellano/02839c61c322cd6ab45182cb5b678e58 to your computer and use it in GitHub Desktop.
This file contains 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
test('setWith() takes a path and a function', async function ({ deepEqual, end }) { | |
const payload = { | |
event: { | |
body: '{"a": 1, "foo": "bar"}' | |
} | |
} | |
const result = setWith('event.body', JSON.parse)(deepFreeze(payload)) | |
const actual = result.event.body | |
const expected = { a: 1, foo: 'bar' } | |
deepEqual(actual, expected, 'applies JSON.parse to the value assigned to that path') | |
end() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment