@@ -4,48 +4,48 @@ import {
44 correctListOfWagons ,
55 extendRouteInformation ,
66 separateTimeOfArrival ,
7- } from " ./train-driver" ;
7+ } from ' ./train-driver' ;
88
9- describe ( " getListOfWagons" , ( ) => {
10- test ( " return the correct array" , ( ) => {
9+ describe ( ' getListOfWagons' , ( ) => {
10+ test ( ' return the correct array' , ( ) => {
1111 expect ( getListOfWagons ( 1 , 5 , 2 , 7 , 4 ) ) . toEqual ( [ 1 , 5 , 2 , 7 , 4 ] ) ;
1212 } ) ;
1313
14- test ( " works for a few arrgument" , ( ) => {
14+ test ( ' works for a few arrgument' , ( ) => {
1515 expect ( getListOfWagons ( 1 , 5 ) ) . toEqual ( [ 1 , 5 ] ) ;
1616 } ) ;
1717
18- test ( " works for a one arrgument" , ( ) => {
18+ test ( ' works for a one arrgument' , ( ) => {
1919 expect ( getListOfWagons ( 1 ) ) . toEqual ( [ 1 ] ) ;
2020 } ) ;
2121
22- test ( " works for many argument" , ( ) => {
22+ test ( ' works for many argument' , ( ) => {
2323 expect ( getListOfWagons ( 1 , 5 , 6 , 3 , 9 , 8 , 4 , 14 , 24 , 7 ) ) . toEqual ( [
2424 1 , 5 , 6 , 3 , 9 , 8 , 4 , 14 , 24 , 7 ,
2525 ] ) ;
2626 } ) ;
2727} ) ;
2828
29- describe ( " fixListOfWagons" , ( ) => {
30- test ( " reorder the first 2 wagons to the end of the array" , ( ) => {
29+ describe ( ' fixListOfWagons' , ( ) => {
30+ test ( ' reorder the first 2 wagons to the end of the array' , ( ) => {
3131 const eachWagonsID = [ 3 , 7 , 1 , 14 , 10 , 4 , 12 , 6 , 23 , 17 , 13 , 20 , 8 , 19 ] ;
3232 const expected = [ 1 , 14 , 10 , 4 , 12 , 6 , 23 , 17 , 13 , 20 , 8 , 19 , 3 , 7 ] ;
3333 expect ( fixListOfWagons ( eachWagonsID ) ) . toEqual ( expected ) ;
3434 } ) ;
3535
36- test ( " works when only 3 wagons given" , ( ) => {
36+ test ( ' works when only 3 wagons given' , ( ) => {
3737 const eachWagonsID = [ 4 , 2 , 1 ] ;
3838 expect ( fixListOfWagons ( eachWagonsID ) ) . toEqual ( [ 1 , 4 , 2 ] ) ;
3939 } ) ;
4040
41- test ( " works for a few wagons" , ( ) => {
41+ test ( ' works for a few wagons' , ( ) => {
4242 const eachWagonsID = [ 3 , 4 , 1 , 5 , 7 , 9 , 10 ] ;
4343 expect ( fixListOfWagons ( eachWagonsID ) ) . toEqual ( [ 1 , 5 , 7 , 9 , 10 , 3 , 4 ] ) ;
4444 } ) ;
4545} ) ;
4646
47- describe ( " correctListOfWagons" , ( ) => {
48- test ( " returns a wagon wieght list with the inserted array of values" , ( ) => {
47+ describe ( ' correctListOfWagons' , ( ) => {
48+ test ( ' returns a wagon wieght list with the inserted array of values' , ( ) => {
4949 const eachWagonsID = [ 1 , 6 , 11 , 15 , 13 , 14 , 17 , 22 , 2 , 16 , 19 , 21 ] ;
5050 const missingWagons = [ 8 , 10 , 5 , 9 , 3 , 7 , 20 ] ;
5151 const expected = [
@@ -54,120 +54,120 @@ describe("correctListOfWagons", () => {
5454 expect ( correctListOfWagons ( eachWagonsID , missingWagons ) ) . toEqual ( expected ) ;
5555 } ) ;
5656
57- test ( " works for short arrays" , ( ) => {
57+ test ( ' works for short arrays' , ( ) => {
5858 const eachWagonsID = [ 1 , 7 , 15 , 24 ] ;
5959 const missingWagons = [ 8 , 6 , 4 ] ;
6060 const expected = [ 1 , 8 , 6 , 4 , 7 , 15 , 24 ] ;
6161 expect ( correctListOfWagons ( eachWagonsID , missingWagons ) ) . toEqual ( expected ) ;
6262 } ) ;
6363
64- test ( " works when missingWagons is longer" , ( ) => {
64+ test ( ' works when missingWagons is longer' , ( ) => {
6565 const eachWagonsID = [ 1 , 7 , 15 , 24 ] ;
6666 const missingWagons = [ 8 , 6 , 4 , 5 , 9 , 21 , 2 , 13 ] ;
6767 const expected = [ 1 , 8 , 6 , 4 , 5 , 9 , 21 , 2 , 13 , 7 , 15 , 24 ] ;
6868 expect ( correctListOfWagons ( eachWagonsID , missingWagons ) ) . toEqual ( expected ) ;
6969 } ) ;
7070} ) ;
7171
72- describe ( " extendRouteInformation" , ( ) => {
73- test ( " correctly extend route information" , ( ) => {
74- const route = { from : " Berlin" , to : " Hamburg" } ;
72+ describe ( ' extendRouteInformation' , ( ) => {
73+ test ( ' correctly extend route information' , ( ) => {
74+ const route = { from : ' Berlin' , to : ' Hamburg' } ;
7575 const moreRouteInformation = {
76- timeOfArrival : " 12:00" ,
77- precipitation : "10" ,
78- temperature : "5" ,
76+ timeOfArrival : ' 12:00' ,
77+ precipitation : '10' ,
78+ temperature : '5' ,
7979 } ;
8080 const expected = {
81- from : " Berlin" ,
82- to : " Hamburg" ,
83- timeOfArrival : " 12:00" ,
84- precipitation : "10" ,
85- temperature : "5" ,
81+ from : ' Berlin' ,
82+ to : ' Hamburg' ,
83+ timeOfArrival : ' 12:00' ,
84+ precipitation : '10' ,
85+ temperature : '5' ,
8686 } ;
8787 expect ( extendRouteInformation ( route , moreRouteInformation ) ) . toEqual (
8888 expected
8989 ) ;
9090 } ) ;
9191
92- test ( " works when not adding precipitation" , ( ) => {
93- const route = { from : " Paris" , to : " London" } ;
94- const moreRouteInformation = { timeOfArrival : " 10:30" , temperature : "20" } ;
92+ test ( ' works when not adding precipitation' , ( ) => {
93+ const route = { from : ' Paris' , to : ' London' } ;
94+ const moreRouteInformation = { timeOfArrival : ' 10:30' , temperature : '20' } ;
9595 const expected = {
96- from : " Paris" ,
97- to : " London" ,
98- timeOfArrival : " 10:30" ,
99- temperature : "20" ,
96+ from : ' Paris' ,
97+ to : ' London' ,
98+ timeOfArrival : ' 10:30' ,
99+ temperature : '20' ,
100100 } ;
101101 expect ( extendRouteInformation ( route , moreRouteInformation ) ) . toEqual (
102102 expected
103103 ) ;
104104 } ) ;
105105
106- test ( " works when written in diffrent order" , ( ) => {
107- const route = { from : " Gothenburg" , to : " Copenhagen" } ;
106+ test ( ' works when written in diffrent order' , ( ) => {
107+ const route = { from : ' Gothenburg' , to : ' Copenhagen' } ;
108108 const moreRouteInformation = {
109- precipitation : "1" ,
110- timeOfArrival : " 21:20" ,
111- temperature : "-6" ,
109+ precipitation : '1' ,
110+ timeOfArrival : ' 21:20' ,
111+ temperature : '-6' ,
112112 } ;
113113 const expected = {
114- from : " Gothenburg" ,
115- to : " Copenhagen" ,
116- precipitation : "1" ,
117- timeOfArrival : " 21:20" ,
118- temperature : "-6" ,
114+ from : ' Gothenburg' ,
115+ to : ' Copenhagen' ,
116+ precipitation : '1' ,
117+ timeOfArrival : ' 21:20' ,
118+ temperature : '-6' ,
119119 } ;
120120 expect ( extendRouteInformation ( route , moreRouteInformation ) ) . toEqual (
121121 expected
122122 ) ;
123123 } ) ;
124124} ) ;
125125
126- describe ( " separateTimeOfArrival" , ( ) => {
127- test ( " seperate timeOfArrival from object" , ( ) => {
126+ describe ( ' separateTimeOfArrival' , ( ) => {
127+ test ( ' seperate timeOfArrival from object' , ( ) => {
128128 const route = {
129- from : " Berlin" ,
130- to : " Hamburg" ,
131- timeOfArrival : " 12:00" ,
132- precipitation : "10" ,
133- temperature : "5" ,
129+ from : ' Berlin' ,
130+ to : ' Hamburg' ,
131+ timeOfArrival : ' 12:00' ,
132+ precipitation : '10' ,
133+ temperature : '5' ,
134134 } ;
135135 const expected = [
136- " 12:00" ,
137- { from : " Berlin" , to : " Hamburg" , precipitation : "10" , temperature : "5" } ,
136+ ' 12:00' ,
137+ { from : ' Berlin' , to : ' Hamburg' , precipitation : '10' , temperature : '5' } ,
138138 ] ;
139139 expect ( separateTimeOfArrival ( route ) ) . toEqual ( expected ) ;
140140 } ) ;
141141
142- test ( " seperate timeOfArrival with shorter object" , ( ) => {
142+ test ( ' seperate timeOfArrival with shorter object' , ( ) => {
143143 const route = {
144- from : " Paris" ,
145- to : " London" ,
146- timeOfArrival : " 10:30" ,
147- temperature : "20" ,
144+ from : ' Paris' ,
145+ to : ' London' ,
146+ timeOfArrival : ' 10:30' ,
147+ temperature : '20' ,
148148 } ;
149149 const expected = [
150- " 10:30" ,
151- { from : " Paris" , to : " London" , temperature : "20" } ,
150+ ' 10:30' ,
151+ { from : ' Paris' , to : ' London' , temperature : '20' } ,
152152 ] ;
153153 expect ( separateTimeOfArrival ( route ) ) . toEqual ( expected ) ;
154154 } ) ;
155155
156- test ( " seperate timeOfArrival from object" , ( ) => {
156+ test ( ' seperate timeOfArrival from object' , ( ) => {
157157 const route = {
158- from : " Gothenburg" ,
159- to : " Copenhagen" ,
160- precipitation : "1" ,
161- timeOfArrival : " 21:20" ,
162- temperature : "-6" ,
158+ from : ' Gothenburg' ,
159+ to : ' Copenhagen' ,
160+ precipitation : '1' ,
161+ timeOfArrival : ' 21:20' ,
162+ temperature : '-6' ,
163163 } ;
164164 const expected = [
165- " 21:20" ,
165+ ' 21:20' ,
166166 {
167- from : " Gothenburg" ,
168- to : " Copenhagen" ,
169- precipitation : "1" ,
170- temperature : "-6" ,
167+ from : ' Gothenburg' ,
168+ to : ' Copenhagen' ,
169+ precipitation : '1' ,
170+ temperature : '-6' ,
171171 } ,
172172 ] ;
173173 expect ( separateTimeOfArrival ( route ) ) . toEqual ( expected ) ;
0 commit comments