Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should replace deep undefined with array', () => {
immutaTest(undefined, ['nested.prop'], (input, path) => {
const output = map(input, path, v => v)
expect(output).toEqual({ nested: { prop: [] } })
return output
})
})
it('should wrap value in an array', () => {
it('should replace deep undefined with array', () => {
immutaTest(undefined, ['nested.prop'], (input, path) => {
const output = filter(input, path, () => true)
expect(output).toEqual({ nested: { prop: [] } })
return output
})
})
it('should wrap value in an array', () => {
it('should replace deep undefined with array', () => {
immutaTest(undefined, ['nested.prop'], (input, path) => {
const output = unshift(input, path, 1)
expect(output).toEqual({ nested: { prop: [1] } })
return output
})
})
})
it('should replace deep undefined with array', () => {
immutaTest(undefined, ['nested.prop'], (input, path) => {
const output = takeRight(input, path)
expect(output).toEqual({ nested: { prop: [] } })
return output
})
})
})
it.skip('should return properties value', () => {
immutaTest(input => {
const output = protect(input)(protectedInput => {
protectedInput.a++
protectedInput.d = '666'
protectedInput.b.c = `🍺 ${protectedInput.d} 🍺`
delete protectedInput.e
})
expect(output).toEqual({
a: 2,
b: { c: '🍺 666 🍺' },
d: '666',
other: {},
})
return output
}, {
a: 1,
b: { c: 3 },