-
Notifications
You must be signed in to change notification settings - Fork 269
/
Copy pathget-smallest-common-number.test.js
38 lines (28 loc) · 1.12 KB
/
get-smallest-common-number.test.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
const { getSmallestCommonNumber } = require('.');
describe('Get common smallest number between two integer arrays', () => {
it('Should return -1 when both has empty array', () => {
const arr1 = [];
const arr2 = [];
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-1);
});
it('Should return -1 when no common between two integer arrays', () => {
const arr1 = [1, 3, 5];
const arr2 = [2, 4, 6];
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-1);
});
it('Should return common smallest number between unsorted two integer arrays', () => {
const arr1 = [-10, 3];
const arr2 = [2, -10, 7];
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-10);
});
it('Should return common smallest number between unsorted two integer arrays', () => {
const arr1 = [-10, 3, -11];
const arr2 = [-11, 2, -10, 7];
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-11);
});
it('Should return common smallest number between sorted two integer arrays', () => {
const arr1 = [2, 3];
const arr2 = [2, 5, 7];
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(2);
});
});