@@ -29,10 +29,15 @@ describe("binaryLCM", () => {
2929 } ,
3030 ) ;
3131
32- test ( "only whole numbers should be accepted" , ( ) => {
33- expect ( ( ) => binaryLCM ( - 2 , - 3 ) ) . toThrowError (
34- "numbers must be positive to determine lowest common multiple" ,
35- ) ;
32+ test ( "only natural numbers should be accepted" , ( ) => {
33+ expect ( ( ) => binaryLCM ( - 2 , - 3 ) ) . toThrowError ( ) ;
34+ expect ( ( ) => binaryLCM ( 2 , - 3 ) ) . toThrowError ( ) ;
35+ expect ( ( ) => binaryLCM ( - 2 , 3 ) ) . toThrowError ( ) ;
36+ } ) ;
37+
38+ test ( "should throw when any of the inputs is not an int" , ( ) => {
39+ expect ( ( ) => binaryLCM ( 1 , 2.5 ) ) . toThrowError ( ) ;
40+ expect ( ( ) => binaryLCM ( 1.5 , 2 ) ) . toThrowError ( ) ;
3641 } ) ;
3742} ) ;
3843
@@ -45,9 +50,7 @@ describe("lowestCommonMultiple", () => {
4550 ) ;
4651
4752 test ( "only positive numbers should be accepted" , ( ) => {
48- expect ( ( ) => lowestCommonMultiple ( [ - 2 , - 3 ] ) ) . toThrowError (
49- "numbers must be positive to determine lowest common multiple" ,
50- ) ;
53+ expect ( ( ) => lowestCommonMultiple ( [ - 2 , - 3 ] ) ) . toThrowError ( ) ;
5154 } ) ;
5255
5356 test ( "at least one number must be passed in" , ( ) => {
0 commit comments