deno.land / x / rambda@v9.1.1 / source / eqBy.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
import { eqByFn } from './eqBy.js'
test('deteremines whether two values map to the same value in the codomain', () => { expect(eqByFn( Math.abs, 5, 5 )).toBe(true) expect(eqByFn( Math.abs, 5, -5 )).toBe(true) expect(eqByFn( Math.abs, -5, 5 )).toBe(true) expect(eqByFn( Math.abs, -5, -5 )).toBe(true) expect(eqByFn( Math.abs, 42, 99 )).toBe(false)})
test('has R.equals semantics', () => { expect(eqByFn( Math.abs, NaN, NaN )).toBe(true) expect(eqByFn( Math.abs, [ 42 ], [ 42 ] )).toBe(true) expect(eqByFn( x => x, { a : 1 }, { a : 1 } )).toBe(true) expect(eqByFn( x => x, { a : 1 }, { a : 2 } )).toBe(false)})
rambda

Version Info

Tagged at
2 months ago