deno.land / x / rambda@v9.1.1 / source / call.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
import { bind } from './bind.js'import { call } from './call.js'
test('happy', () => { expect(call( Math.max, 1, 2, 3, -99, 42, 6, 7 )).toBe(42)})
test('accepts one or more arguments', () => { const fn = function (){ return arguments.length } expect(call(fn)).toBe(0) expect(call(fn, 'x')).toBe(1) expect(call( fn, 'x', 'y' )).toBe(2) expect(call( fn, 'x', 'y', 'z' )).toBe(3)})
test('provides no way to specify context', () => { var obj = { method (){ return this === obj }, } expect(call(obj.method)).toBe(false) expect(call(bind(obj.method, obj))).toBe(true)})
rambda

Version Info

Tagged at
2 months ago