deno.land / x / rambda@v9.1.1 / source / whereEq.spec.js

whereEq.spec.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { whereEq } from './whereEq.js'
test('when true', () => { const condition = { a : 1 } const input = { a : 1, b : 2, }
const result = whereEq(condition, input) const expectedResult = true
expect(result).toEqual(expectedResult)})
test('when false', () => { const condition = { a : 1 } const input = { b : 2 }
const result = whereEq(condition, input) const expectedResult = false
expect(result).toEqual(expectedResult)})
test('with nested object', () => { const condition = { a : { b : 1 } } const input = { a : { b : 1 }, c : 2, }
const result = whereEq(condition)(input) const expectedResult = true
expect(result).toEqual(expectedResult)})
test('with wrong input', () => { const condition = { a : { b : 1 } }
expect(() => whereEq(condition, null)).toThrowErrorMatchingInlineSnapshot('"Cannot read properties of null (reading \'a\')"')})
rambda

Version Info

Tagged at
2 months ago