-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathtests.js
More file actions
101 lines (94 loc) · 2.05 KB
/
tests.js
File metadata and controls
101 lines (94 loc) · 2.05 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'use strict';
var generic = require('fast-deep-equal-git/spec/tests.js');
var es6 = require('fast-deep-equal-git/spec/es6tests.js');
const reactElementA = {
$$typeof: 'react.element',
type: 'div',
key: null,
ref: null,
props: { x: 1 },
_owner: {},
_store: {},
};
// in reality the _owner object is much more complex (and contains over dozen circular references)
reactElementA._owner.children = [reactElementA];
const reactElementA2 = {
$$typeof: 'react.element',
type: 'div',
key: null,
ref: null,
props: { x: 1 },
_owner: {},
_store: {},
};
reactElementA2._owner.children = [reactElementA2];
const reactElementB = {
$$typeof: 'react.element',
type: 'div',
key: null,
ref: null,
props: { x: 2 },
_owner: {},
_store: {},
};
reactElementB._owner.children = [reactElementB];
const react = [
{
description: 'React elements',
reactSpecific: true,
tests: [
{
description: 'an element compared with itself',
value1: reactElementA,
value2: reactElementA,
equal: true,
},
{
description: 'two elements equal by value',
value1: reactElementA,
value2: reactElementA2,
equal: true,
},
{
description: 'two elements unequal by value',
value1: reactElementA,
value2: reactElementB,
equal: false,
},
],
},
];
const exampleFn = () => 'foo';
const functions = [
{
description: 'Functions',
reactSpecific: false,
tests: [
{
description: 'a function compared with itself',
value1: exampleFn,
value2: exampleFn,
equal: true,
},
{
description: 'two equal inline functions',
value1: () => 'foo',
value2: () => 'foo',
equal: true,
},
{
description: 'two functions with different results',
value1: () => 'foo',
value2: () => 'bar',
equal: false,
},
],
},
];
module.exports = {
generic,
es6,
react,
functions,
all: [...generic, ...es6, ...react, ...functions],
};