File tree 1 file changed +31
-0
lines changed
src/_Problems_/get-smallest-common-number
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments