Created
May 28, 2021 18:29
-
-
Save sergueyarellano/7f6018b72717fa45fa0cd11dc7aab42b 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('filterResponse() should apply filters specified in config object to mappedResponse', async function ({ deepEqual, end }) { | |
const payload = { | |
data: { | |
config: { | |
filters: [ | |
(element) => element.x < 4 | |
] | |
}, | |
mappedResponse: [ | |
{ x: 1, y: 2 }, | |
{ x: 3, y: 4 }, | |
{ x: 5, y: 6 } | |
] | |
} | |
} | |
const result = filterResponse(deepFreeze(payload)) | |
const actual = result.data.mappedResponse | |
const expected = [ | |
{ x: 1, y: 2 }, | |
{ x: 3, y: 4 } | |
] | |
deepEqual(actual, expected) | |
end() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment