Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 28, 2021 18:31
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/42d35b9d9de66b727951cfbbced465bc to your computer and use it in GitHub Desktop.
Save sergueyarellano/42d35b9d9de66b727951cfbbced465bc to your computer and use it in GitHub Desktop.
const { result } = await pipe(
composeRequest,
makeRequest,
mapResponse,
setWith('data.mappedResponse', applyFilters(config.filters)),
createResult
)(lift(config))
test('applyFilters() should apply filters to every element in the array passed', async function ({ deepEqual, end }) {
const filters = [(element) => element.x < 4]
const data = [
{ x: 1, y: 2 },
{ x: 3, y: 4 },
{ x: 5, y: 6 }
]
const actual = applyFilters(filters)(deepFreeze(data))
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