Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0111f5d

Browse files
committed
Merge branch 'master' of github.com:knaxus/problem-solving-javascript into problems
2 parents 11ef12e + b52001e commit 0111f5d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 unsorted two integer arrays', () => {
19+
const arr1 = [-10, 3];
20+
const arr2 = [2, -10, 7];
21+
22+
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(-10);
23+
});
24+
25+
it('Should return common smallest number between sorted two integer arrays', () => {
26+
const arr1 = [2, 3];
27+
const arr2 = [2, 5, 7];
28+
29+
expect(getSmallestCommonNumber(arr1, arr2)).toEqual(2);
30+
});
31+
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /