Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 28, 2021 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergueyarellano/7f6018b72717fa45fa0cd11dc7aab42b to your computer and use it in GitHub Desktop.
Save sergueyarellano/7f6018b72717fa45fa0cd11dc7aab42b to your computer and use it in GitHub Desktop.
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