File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ import counter from '../counter' ;
2
+
3
+ describe ( 'Meals Counter function Test' , ( ) => {
4
+ const mealArray = [
5
+ {
6
+ mealID : 1234 ,
7
+ mealName : 'Baked beans' ,
8
+ mealDescription : 'it is a canned meal, no need for a description' ,
9
+ } ,
10
+ {
11
+ mealID : 1890 ,
12
+ mealName : 'Fried Rice' ,
13
+ mealDescription : 'Just fry the rice' ,
14
+ } ,
15
+ ] ;
16
+ test ( 'should return meals array length of 2' , ( ) => {
17
+ const mealLength = counter . meals ( mealArray ) ;
18
+ expect ( mealLength ) . toBe ( 2 ) ;
19
+ } ) ;
20
+
21
+ test ( 'should return meals array length of 5 ' , ( ) => {
22
+ mealArray . push (
23
+ {
24
+ mealID : 2040 ,
25
+ mealName : 'Another meal' ,
26
+ mealDescription : 'Unfortunately there is no description' ,
27
+ } ,
28
+ {
29
+ mealID : 2990 ,
30
+ mealName : 'this is a nice meal' ,
31
+ mealDescription : 'Unfortunately there is no description' ,
32
+ } ,
33
+ ) ;
34
+ const mealLength = counter . meals ( mealArray ) ;
35
+ expect ( mealLength ) . toBe ( 4 ) ;
36
+ } ) ;
37
+ } ) ;
You can’t perform that action at this time.
0 commit comments