-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtest.js
More file actions
39 lines (30 loc) · 1.02 KB
/
Copy pathtest.js
File metadata and controls
39 lines (30 loc) · 1.02 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
import test from 'ava';
import arrayEqual from './index.js';
test('compare arrays with same numeric elements', t => {
t.true(arrayEqual([1, 2, 3], [1, 2, 3]));
});
test('compare arrays with different numeric elements', t => {
t.false(arrayEqual([1, 2, 3], [4, 5, 6]));
});
test('compare arrays of different lengths', t => {
t.false(arrayEqual([1, 2, 3], [1, 2, 3, 4]));
});
test('compare arrays with same string elements', t => {
t.true(arrayEqual(['a', 'b', 'c'], ['a', 'b', 'c']));
});
test('compare arrays with different string elements', t => {
t.false(arrayEqual(['a', 'b', 'c'], ['d', 'e', 'f']));
});
test('compare arrays with mixed types', t => {
t.false(arrayEqual(['1', 2, 3], [1, 2, 3]));
});
test('compare empty arrays', t => {
t.true(arrayEqual([], []));
});
test('compare arrays with same objects', t => {
const object = {key: 'value'};
t.true(arrayEqual([object, object], [object, object]));
});
test('compare arrays with different objects', t => {
t.false(arrayEqual([{key: 'value'}], [{key: 'value'}]));
});