@@ -13,71 +13,67 @@ We have set things up already so that this file can see your function from the o
1313const findMax = require ( "./max.js" ) ;
1414
1515describe ( "calculateMedian" , ( ) => {
16- // Given an empty array
17- // When passed to the max function
18- // Then it should return -Infinity
19- // Delete this test.todo and replace it with a test.
16+ // Given an empty array
17+ // When passed to the max function
18+ // Then it should return -Infinity
19+ // Delete this test.todo and replace it with a test.
2020
2121 it ( "empty array returns -Infinity" , ( ) => {
2222 const list = [ ] ;
2323 expect ( findMax ( list ) ) . toEqual ( "-Infinity" ) ;
2424 } ) ;
2525
26- // Given an array with one number
27- // When passed to the max function
28- // Then it should return that number
26+ // Given an array with one number
27+ // When passed to the max function
28+ // Then it should return that number
2929
3030 it ( "array with one number returns that number" , ( ) => {
3131 const list = [ 2 ] ;
3232 expect ( findMax ( list ) ) . toEqual ( 2 ) ;
3333 } ) ;
3434
35- // Given an array with both positive and negative numbers
36- // When passed to the max function
37- // Then it should return the largest number overall
35+ // Given an array with both positive and negative numbers
36+ // When passed to the max function
37+ // Then it should return the largest number overall
3838
3939 it ( "array with +ve and -ve numbers, returns largest number overall" , ( ) => {
4040 const list = [ 10 , - 15 ] ;
4141 expect ( findMax ( list ) ) . toEqual ( 10 ) ;
4242 } ) ;
4343
44-
45- // Given an array with just negative numbers
46- // When passed to the max function
47- // Then it should return the closest one to zero
44+ // Given an array with just negative numbers
45+ // When passed to the max function
46+ // Then it should return the closest one to zero
4847
4948 it ( "array -ve numbers, returns closest to zero" , ( ) => {
5049 const list = [ - 1 , - 2 , - 3 , - 15 ] ;
5150 expect ( findMax ( list ) ) . toEqual ( - 1 ) ;
5251 } ) ;
5352
54-
55- // Given an array with decimal numbers
56- // When passed to the max function
57- // Then it should return the largest decimal number
53+ // Given an array with decimal numbers
54+ // When passed to the max function
55+ // Then it should return the largest decimal number
5856
5957 it ( "array with decimal numbers should return largest decimal number" , ( ) => {
6058 const list = [ 1.9 , 2.8999 , 3.1 ] ;
6159 expect ( findMax ( list ) ) . toEqual ( 3.1 ) ;
6260 } ) ;
6361
64-
65- // Given an array with non-number values
66- // When passed to the max function
67- // Then it should return the max and ignore non-numeric values
62+ // Given an array with non-number values
63+ // When passed to the max function
64+ // Then it should return the max and ignore non-numeric values
6865
6966 it ( "array with non-number values, returns the max and ignore non-numeric values" , ( ) => {
7067 const list = [ 1 , "a" , 2 , "b" , 3 , "c" ] ;
7168 expect ( findMax ( list ) ) . toEqual ( 3 ) ;
7269 } ) ;
7370
74-
75- // Given an array with only non-number values
76- // When passed to the max function
77- // Then it should return the least surprising value given how it behaves for all other inputs
71+ // Given an array with only non-number values
72+ // When passed to the max function
73+ // Then it should return the least surprising value given how it behaves for all other inputs
7874
7975 it ( "array with only non-number values, return the least surprising value given how it behaves for all other inputs" , ( ) => {
8076 const list = [ "a" , "b" , "c" ] ;
8177 expect ( findMax ( list ) ) . toEqual ( "-Infinity" ) ;
8278 } ) ;
83- } ) ;
79+ } ) ;
0 commit comments