@@ -16,49 +16,28 @@ const findMax = require("./max.js");
1616// When passed to the max function
1717// Then it should return -Infinity
1818// Delete this test.todo and replace it with a test.
19- //test.todo("given an empty array, returns -Infinity");
20- test ( "given an empty array, returns -Infinity" , ( ) => {
21- expect ( findMax ( [ ] ) ) . toBe ( - Infinity ) ;
22- } ) ;
19+ test . todo ( "given an empty array, returns -Infinity" ) ;
2320
2421// Given an array with one number
2522// When passed to the max function
2623// Then it should return that number
27- test ( "given an array with one number, returns that number" , ( ) => {
28- expect ( findMax ( [ 42 ] ) ) . toBe ( 42 ) ;
29- } ) ;
3024
3125// Given an array with both positive and negative numbers
3226// When passed to the max function
3327// Then it should return the largest number overall
34- test ( "given an array with positive and negative numbers, returns the largest" , ( ) => {
35- expect ( findMax ( [ - 10 , 5 , 3 , - 2 ] ) ) . toBe ( 5 ) ;
36- } ) ;
3728
3829// Given an array with just negative numbers
3930// When passed to the max function
4031// Then it should return the closest one to zero
41- test ( "given an array with only negative numbers, returns the closest to zero" , ( ) => {
42- expect ( findMax ( [ - 10 , - 3 , - 20 ] ) ) . toBe ( - 3 ) ;
43- } ) ;
4432
4533// Given an array with decimal numbers
4634// When passed to the max function
4735// Then it should return the largest decimal number
48- test ( "given an array with decimal numbers, returns the largest decimal" , ( ) => {
49- expect ( findMax ( [ 1.2 , 3.5 , 2.8 ] ) ) . toBe ( 3.5 ) ;
50- } ) ;
5136
5237// Given an array with non-number values
5338// When passed to the max function
5439// Then it should return the max and ignore non-numeric values
55- test ( "given an array with non-number values, ignores them and returns the max" , ( ) => {
56- expect ( findMax ( [ 'hey' , 10 , 'hi' , 60 , 10 ] ) ) . toBe ( 60 ) ;
57- } ) ;
5840
5941// Given an array with only non-number values
6042// When passed to the max function
6143// Then it should return the least surprising value given how it behaves for all other inputs
62- test ( "given an array with only non-number values, returns -Infinity" , ( ) => {
63- expect ( findMax ( [ 'a' , 'b' , null , undefined ] ) ) . toBe ( - Infinity ) ;
64- } ) ;
0 commit comments