-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmerge.test.ts
46 lines (33 loc) · 1.21 KB
/
merge.test.ts
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
import merge from './merge';
import { expect } from 'chai';
import { describe, it } from 'mocha';
describe('merge', () => {
it('should merge two sorted arrays', () => {
const collection_1 = [1, 3, 5, 7];
const collection_2 = [2, 4, 6];
const expected = [1, 2, 3, 4, 5, 6, 7];
const result = merge(collection_1, collection_2);
expect(result).to.deep.equal(expected);
});
it('should handle empty arrays', () => {
const collection_1: Array<number> = [];
const collection_2: Array<number> = [];
const expected: Array<number> = [];
const result = merge(collection_1, collection_2);
expect(result).to.deep.equal(expected);
});
it('should handle one empty array', () => {
const collection_1 = [1, 2, 3];
const collection_2: Array<number> = [];
const expected = [1, 2, 3];
const result = merge(collection_1, collection_2);
expect(result).to.deep.equal(expected);
});
it('should handle arrays with different lengths', () => {
const collection_1 = [1, 3, 5, 7, 9];
const collection_2 = [2, 4, 6];
const expected = [1, 2, 3, 4, 5, 6, 7, 9];
const result = merge(collection_1, collection_2);
expect(result).to.deep.equal(expected);
});
});