Created
May 28, 2021 17:11
-
-
Save sergueyarellano/02c9214df75564bcb357e63bd2a55895 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