Skip to content

Commit 886e4fd

Browse files
author
Darwin Cahyadi
committed
add test smallest number
1 parent 1cd6613 commit 886e4fd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { getSmallestCommonNumber } = require('.');
2+
3+
describe('Get common smallest number between two integer arrays', () => {
4+
it('Should return -1 when both has empty array', () => {
5+
const arr1 = [];
6+
const arr2 = [];
7+
8+
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-1);
9+
});
10+
11+
it('Should return -1 when no common between two integer arrays', () => {
12+
const arr1 = [1, 3, 5];
13+
const arr2 = [2, 4, 6];
14+
15+
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-1);
16+
});
17+
18+
it('Should return common smallest number between two integer arrays', () => {
19+
const arr1 = [2, 3];
20+
const arr2 = [2, 5, 7];
21+
22+
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(2);
23+
});
24+
});

0 commit comments

Comments
 (0)