deno.land / x / rambda@v9.1.1 / source / clamp.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
import { clamp } from './clamp.js'
test('when min is greater than max', () => { expect(() => clamp( -5, -10, 5 )).toThrowErrorMatchingInlineSnapshot('"min must not be greater than max in clamp(min, max, value)"')})
test('rambda specs', () => { expect(clamp( 1, 10, 0 )).toBe(1) expect(clamp( 3, 12, 1 )).toBe(3) expect(clamp( -15, 3, -100 )).toBe(-15) expect(clamp( 1, 10, 20 )).toBe(10) expect(clamp( 3, 12, 23 )).toBe(12) expect(clamp( -15, 3, 16 )).toBe(3) expect(clamp( 1, 10, 4 )).toBe(4) expect(clamp( 3, 12, 6 )).toBe(6) expect(clamp( -15, 3, 0 )).toBe(0)})
rambda

Version Info

Tagged at
2 months ago