@@ -50,6 +50,17 @@ function list(...values) {
5050 return new LimitedArray ( values ) ;
5151}
5252
53+ function time ( timeOfArrival , route ) {
54+ Object . defineProperty ( route , 'timeOfArrival' , {
55+ configurable : false ,
56+ writable : false ,
57+ enumerable : true ,
58+ value : timeOfArrival ,
59+ } ) ;
60+
61+ return route ;
62+ }
63+
5364describe ( 'getListOfWagons' , ( ) => {
5465 test ( 'returns the correct array' , ( ) => {
5566 expect ( getListOfWagons ( 1 , 5 , 2 , 7 , 4 ) ) . toEqual ( [ 1 , 5 , 2 , 7 , 4 ] ) ;
@@ -181,13 +192,12 @@ describe('extendRouteInformation', () => {
181192
182193describe ( 'separateTimeOfArrival' , ( ) => {
183194 test ( 'separates timeOfArrival from complete object' , ( ) => {
184- const route = {
195+ const route = time ( '12:00' , {
185196 from : 'Berlin' ,
186197 to : 'Hamburg' ,
187- timeOfArrival : '12:00' ,
188198 precipitation : '10' ,
189199 temperature : '5' ,
190- } ;
200+ } ) ;
191201
192202 const expected = [
193203 '12:00' ,
@@ -198,12 +208,11 @@ describe('separateTimeOfArrival', () => {
198208 } ) ;
199209
200210 test ( 'separates timeOfArrival with smaller object' , ( ) => {
201- const route = {
211+ const route = time ( '10:30' , {
202212 from : 'Paris' ,
203213 to : 'London' ,
204- timeOfArrival : '10:30' ,
205214 temperature : '20' ,
206- } ;
215+ } ) ;
207216
208217 const expected = [
209218 '10:30' ,
@@ -214,13 +223,12 @@ describe('separateTimeOfArrival', () => {
214223 } ) ;
215224
216225 test ( 'separates timeOfArrival from differently ordered object' , ( ) => {
217- const route = {
226+ const route = time ( '21:20' , {
218227 from : 'Gothenburg' ,
219228 to : 'Copenhagen' ,
220229 precipitation : '1' ,
221- timeOfArrival : '21:20' ,
222230 temperature : '-6' ,
223- } ;
231+ } ) ;
224232
225233 const expected = [
226234 '21:20' ,
0 commit comments