mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
adapt tests to 96ff59d
✅
This commit is contained in:
parent
0fa9610b30
commit
88c78c243f
10 changed files with 24 additions and 20 deletions
|
@ -171,9 +171,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
|
@ -153,9 +153,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
|
@ -231,9 +231,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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 validateTrip = createValidateTrip(cfg)
|
||||||
const validate = createValidate(cfg, {
|
const validate = createValidate(cfg, {
|
||||||
|
|
|
@ -164,9 +164,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
|
@ -305,7 +305,11 @@ const validateJourneys = (val, js, name = 'journeys') => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const validateTrip = (val, trip, name = 'trip') => {
|
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) => {
|
const createValidateArrivalOrDeparture = (type, cfg) => {
|
||||||
|
|
|
@ -214,9 +214,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
|
@ -237,9 +237,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
|
@ -198,11 +198,11 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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()
|
t.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -167,9 +167,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs.find(leg => leg.line)
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
|
@ -151,9 +151,9 @@ test('trip details', async (t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const p = journeys[0].legs[0]
|
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')
|
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')
|
validate(t, trip, 'trip', 'trip')
|
||||||
t.end()
|
t.end()
|
||||||
|
|
Loading…
Add table
Reference in a new issue