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

dissoc.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { dissoc } from './dissoc.js'
test('input is null or undefined', () => { expect(dissoc('b', null)).toEqual({}) expect(dissoc('b', undefined)).toEqual({})})
test('property exists curried', () => { expect(dissoc('b')({ a : 1, b : 2, })).toEqual({ a : 1 })})
test('property doesn\'t exists', () => { expect(dissoc('c', { a : 1, b : 2, })).toEqual({ a : 1, b : 2, })})
test('works with non-string property', () => { expect(dissoc(42, { a : 1, 42 : 2, })).toEqual({ a : 1 })
expect(dissoc(null, { a : 1, null : 2, })).toEqual({ a : 1 })
expect(dissoc(undefined, { a : 1, undefined : 2, })).toEqual({ a : 1 })})
test('includes prototype properties', () => { function Rectangle(width, height){ this.width = width this.height = height } const area = Rectangle.prototype.area = function (){ return this.width * this.height } const rect = new Rectangle(7, 6)
expect(dissoc('area', rect)).toEqual({ width : 7, height : 6, })
expect(dissoc('width', rect)).toEqual({ height : 6, area, })
expect(dissoc('depth', rect)).toEqual({ width : 7, height : 6, area, })})
rambda

Version Info

Tagged at
2 months ago