@@ -16,75 +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-
20- test ( "given an empty array, returns -Infinity" , ( ) => {
21- const currentOutput = findMax ( [ ] ) ;
22- const targetOutput = - Infinity ;
23-
24- expect ( currentOutput ) . toEqual ( targetOutput ) ;
25- } ) ;
19+ test . todo ( "given an empty array, returns -Infinity" ) ;
2620
2721// Given an array with one number
2822// When passed to the max function
2923// Then it should return that number
3024
31- test ( "given an array with one number, returns that number" , ( ) => {
32- const currentOutput = findMax ( [ 42 ] ) ;
33- const targetOutput = 42 ;
34-
35- expect ( currentOutput ) . toEqual ( targetOutput ) ;
36- } ) ;
37-
38-
3925// Given an array with both positive and negative numbers
4026// When passed to the max function
4127// Then it should return the largest number overall
4228
43- test ( "given an array with positive and negative numbers, returns the largest" , ( ) => {
44- const currentOutput = findMax ( [ - 25 , 5 , 20 , - 3 , 15 ] ) ;
45- const targetOutput = 20 ;
46-
47- expect ( currentOutput ) . toEqual ( targetOutput ) ;
48- } ) ;
4929// Given an array with just negative numbers
5030// When passed to the max function
5131// Then it should return the closest one to zero
5232
53- test ( "given an array of only negative numbers, returns the closest to zero" , ( ) => {
54- const currentOutput = findMax ( [ - 50 , - 3 , - 20 , - 10 ] ) ;
55- const targetOutput = - 3 ;
56-
57- expect ( currentOutput ) . toEqual ( targetOutput ) ;
58- } ) ;
59-
6033// Given an array with decimal numbers
6134// When passed to the max function
6235// Then it should return the largest decimal number
6336
64- test ( "given an array of decimal numbers, returns the largest decimal" , ( ) => {
65- const currentOutput = findMax ( [ 1.1 , 3.5 , 2.9 , 3.4 ] ) ;
66- const targetOutput = 3.5 ;
67-
68- expect ( currentOutput ) . toEqual ( targetOutput ) ;
69- } ) ;
70-
7137// Given an array with non-number values
7238// When passed to the max function
7339// Then it should return the max and ignore non-numeric values
7440
75- test ( "given an array with non-number values, returns correct max (ignoring non-numbers)" , ( ) => {
76- const currentOutput = findMax ( [ 10 , "hi" , 50 , true , 3 ] ) ;
77- const targetOutput = 50 ;
78-
79- expect ( currentOutput ) . toEqual ( targetOutput ) ;
80- } ) ;
81-
8241// Given an array with only non-number values
8342// When passed to the max function
8443// Then it should return the least surprising value given how it behaves for all other inputs
85- test ( "given an array with only non-number values, returns -Infinity" , ( ) => {
86- const currentOutput = findMax ( [ "a" , null , undefined , { } , [ ] , true ] ) ;
87- const targetOutput = - Infinity ;
88-
89- expect ( currentOutput ) . toEqual ( targetOutput ) ;
90- } ) ;
0 commit comments