-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmeandering-array.test.js
More file actions
61 lines (59 loc) · 1.15 KB
/
meandering-array.test.js
File metadata and controls
61 lines (59 loc) · 1.15 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
const meanderingArray = require("./meandering-array.js");
describe("Meandering Array code challenge", () => {
describe("tests that an array of random numbers (including negative) returns in a biggest, smallest, second-biggest, second-smallest order", () => {
it("should return a sorted array of numbers when a short array is passed as a parameter", () => {
expect(meanderingArray([1, -3, 5, 2, 8, -9, -10])).toEqual([
8,
-10,
5,
-9,
2,
-3,
1
]);
});
it("should return a sorted array of numbers when a long array is passed as a parameter", () => {
expect(
meanderingArray([
1,
2,
3,
4,
5,
6,
7,
8,
9,
-1,
-2,
-3,
-4,
-5,
-6,
-7,
-8,
-9
])
).toEqual([
9,
-9,
8,
-8,
7,
-7,
6,
-6,
5,
-5,
4,
-4,
3,
-3,
2,
-2,
1,
-1
]);
});
});
});