@@ -16,12 +16,30 @@ E.g. dedupe([1, 2, 1]) target output: [1, 2]
1616// Given an empty array
1717// When passed to the dedupe function
1818// Then it should return an empty array
19- test . todo ( "given an empty array, it returns an empty array" ) ;
2019
20+ test ( "given an empty array, it returns an empty array" , ( ) => {
21+ const currentOutput = dedupe ( [ ] ) ;
22+ const targetOutput = [ ] ;
23+
24+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
25+ } ) ;
2126// Given an array with no duplicates
2227// When passed to the dedupe function
2328// Then it should return a copy of the original array
2429
30+ test ( "Given an array with no duplicates, it returns an the same array" , ( ) => {
31+ const currentOutput = dedupe ( [ 1 , 4 , 6 , "d" , "a" , "x" , "e" , 0 , 7 , 8 ] ) ;
32+ const targetOutput = [ 1 , 4 , 6 , "d" , "a" , "x" , "e" , 0 , 7 , 8 ] ;
33+
34+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
35+ } ) ;
2536// Given an array with strings or numbers
2637// When passed to the dedupe function
27- // Then it should remove the duplicate values, preserving the first occurence of each element
38+ // Then it should remove the duplicate values, preserving the first occurrence of each element
39+
40+ test ( "Given an array with strings or numbers, it returns an the array whit no duplicated elements" , ( ) => {
41+ const currentOutput = dedupe ( [ 'a' , 'a' , 'a' , 'b' , 'b' , 'c' ] ) ;
42+ const targetOutput = [ 'a' , 'b' , 'c' ] ;
43+
44+ expect ( currentOutput ) . toEqual ( targetOutput ) ;
45+ } ) ;
0 commit comments