adapt tests to 96ff59d

This commit is contained in:
Jannis R 2018-11-22 00:17:28 +01:00
parent 0fa9610b30
commit 88c78c243f
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
10 changed files with 24 additions and 20 deletions

View file

@ -171,9 +171,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()

View file

@ -153,9 +153,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()

View file

@ -231,9 +231,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
const validateTrip = createValidateTrip(cfg)
const validate = createValidate(cfg, {

View file

@ -164,9 +164,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()

View file

@ -305,7 +305,11 @@ const validateJourneys = (val, js, name = 'journeys') => {
}
const validateTrip = (val, trip, name = 'trip') => {
val.journeyLeg(val, trip, name)
const withFakeTripId = Object.assign({
tripId: trip.id
}, trip)
delete withFakeTripId.id
val.journeyLeg(val, withFakeTripId, name)
}
const createValidateArrivalOrDeparture = (type, cfg) => {

View file

@ -214,9 +214,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()

View file

@ -237,9 +237,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()

View file

@ -198,11 +198,11 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, { when })
const trip = await client.trip(p.tripId, p.line.name, { when })
validate(t, trip, 'journeyLeg', 'trip')
validate(t, trip, 'trip', 'trip')
t.end()
})

View file

@ -167,9 +167,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs.find(leg => leg.line)
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()

View file

@ -151,9 +151,9 @@ test('trip details', async (t) => {
})
const p = journeys[0].legs[0]
t.ok(p.id, 'precondition failed')
t.ok(p.tripId, 'precondition failed')
t.ok(p.line.name, 'precondition failed')
const trip = await client.trip(p.id, p.line.name, {when})
const trip = await client.trip(p.tripId, p.line.name, {when})
validate(t, trip, 'trip', 'trip')
t.end()