@@ -178,22 +178,33 @@ describe('Climb CRUD', () => {
178178 const newIDs = await climbs . addOrUpdateClimbs (
179179 testUser ,
180180 routesArea . metadata . area_id ,
181- newClimbsToAdd )
181+ newClimbsToAdd
182+ )
182183
183184 expect ( newIDs ) . toHaveLength ( newClimbsToAdd . length )
184185
185- const climb0 = await climbs . findOneClimbByMUUID ( muid . from ( newIDs [ 0 ] ) )
186-
187- // Validate new climb
188- expect ( climb0 ) . toMatchObject ( {
189- name : newClimbsToAdd [ 0 ] . name ,
190- type : sanitizeDisciplines ( newClimbsToAdd [ 0 ] . disciplines ) ,
191- content : {
192- description : newClimbsToAdd [ 0 ] . description ,
193- location : newClimbsToAdd [ 0 ] . location ,
194- protection : newClimbsToAdd [ 0 ] . protection
195- }
196- } )
186+ // Validate all climbs were added, and in the order we expect
187+ for ( const [ i , climbIn ] of newClimbsToAdd . entries ( ) ) {
188+ const climbOut = await climbs . findOneClimbByMUUID ( muid . from ( newIDs [ i ] ) )
189+
190+ // Validate new climb
191+ expect ( climbOut ) . toMatchObject ( {
192+ name : climbIn . name ,
193+ type : sanitizeDisciplines ( climbIn . disciplines ) ,
194+ metadata : {
195+ left_right_index : i + 1
196+ } ,
197+ ...climbIn . description === undefined
198+ ? { }
199+ : {
200+ content : {
201+ description : climbIn . description ,
202+ location : climbIn . location ,
203+ protection : climbIn . protection
204+ }
205+ }
206+ } )
207+ }
197208
198209 // California contains subareas. Should fail.
199210 await expect (
0 commit comments