mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
NAH.SH: remove unnecessary headers, skip radar test
This commit is contained in:
parent
0987383c72
commit
ca6e5a0d54
2 changed files with 50 additions and 55 deletions
|
@ -11,12 +11,9 @@ const products = require('./products')
|
|||
// todo: journey prices
|
||||
|
||||
const transformReqBody = (body) => {
|
||||
// todo: all headers necessary?
|
||||
body.client = {
|
||||
id: 'NAHSH',
|
||||
name: 'NAHSHPROD',
|
||||
os: 'iOS',
|
||||
type: 'IPH',
|
||||
v: '3000700'
|
||||
}
|
||||
body.ver = '1.16'
|
||||
|
@ -144,7 +141,7 @@ const nahshProfile = {
|
|||
formatProducts,
|
||||
|
||||
journeyLeg: true,
|
||||
radar: false // todo: fix nameless station bug
|
||||
radar: false // todo: see #34
|
||||
}
|
||||
|
||||
module.exports = nahshProfile
|
||||
|
|
100
test/nahsh.js
100
test/nahsh.js
|
@ -401,54 +401,52 @@ test('location', co(function* (t) {
|
|||
t.end()
|
||||
}))
|
||||
|
||||
// todo: fix nameless station bug
|
||||
// test('radar Kiel', co(function* (t) {
|
||||
// const vehicles = yield client.radar(54.4, 10.0, 54.2, 10.2, {
|
||||
// duration: 5 * 60, when
|
||||
// })
|
||||
//
|
||||
// t.ok(Array.isArray(vehicles))
|
||||
// t.ok(vehicles.length > 0)
|
||||
// for (let v of vehicles) {
|
||||
//
|
||||
// // todo
|
||||
// // t.ok(findStation(v.direction))
|
||||
// assertValidLine(t, v.line)
|
||||
//
|
||||
// t.equal(typeof v.location.latitude, 'number')
|
||||
// t.ok(v.location.latitude <= 57, 'vehicle is too far away')
|
||||
// t.ok(v.location.latitude >= 51, 'vehicle is too far away')
|
||||
// t.equal(typeof v.location.longitude, 'number')
|
||||
// t.ok(v.location.longitude >= 7, 'vehicle is too far away')
|
||||
// t.ok(v.location.longitude <= 13, 'vehicle is too far away')
|
||||
//
|
||||
// t.ok(Array.isArray(v.nextStops))
|
||||
// for (let st of v.nextStops) {
|
||||
// assertValidStopover(t, st, true)
|
||||
//
|
||||
// if (st.arrival) {
|
||||
// t.equal(typeof st.arrival, 'string')
|
||||
// const arr = +new Date(st.arrival)
|
||||
// // note that this can be an ICE train
|
||||
// t.ok(isRoughlyEqual(14 * hour, +when, arr))
|
||||
// }
|
||||
// if (st.departure) {
|
||||
// t.equal(typeof st.departure, 'string')
|
||||
// const dep = +new Date(st.departure)
|
||||
// t.ok(isRoughlyEqual(14 * hour, +when, dep))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// t.ok(Array.isArray(v.frames))
|
||||
// for (let f of v.frames) {
|
||||
// assertValidStation(t, f.origin, true)
|
||||
// // can contain stations in germany which don't have a products property, would break
|
||||
// // assertValidStationProducts(t, f.origin.products)
|
||||
// assertValidStation(t, f.destination, true)
|
||||
// // can contain stations in germany which don't have a products property, would break
|
||||
// // assertValidStationProducts(t, f.destination.products)
|
||||
// t.equal(typeof f.t, 'number')
|
||||
// }
|
||||
// }
|
||||
// t.end()
|
||||
// }))
|
||||
// todo: see #34
|
||||
test.skip('radar Kiel', co(function* (t) {
|
||||
const vehicles = yield client.radar(54.4, 10.0, 54.2, 10.2, {
|
||||
duration: 5 * 60, when
|
||||
})
|
||||
|
||||
t.ok(Array.isArray(vehicles))
|
||||
t.ok(vehicles.length > 0)
|
||||
for (let v of vehicles) {
|
||||
|
||||
// todo
|
||||
// t.ok(findStation(v.direction))
|
||||
assertValidLine(t, v.line)
|
||||
|
||||
t.equal(typeof v.location.latitude, 'number')
|
||||
t.ok(v.location.latitude <= 57, 'vehicle is too far away')
|
||||
t.ok(v.location.latitude >= 51, 'vehicle is too far away')
|
||||
t.equal(typeof v.location.longitude, 'number')
|
||||
t.ok(v.location.longitude >= 7, 'vehicle is too far away')
|
||||
t.ok(v.location.longitude <= 13, 'vehicle is too far away')
|
||||
|
||||
t.ok(Array.isArray(v.nextStops))
|
||||
for (let st of v.nextStops) {
|
||||
assertValidStopover(t, st, true)
|
||||
|
||||
if (st.arrival) {
|
||||
t.equal(typeof st.arrival, 'string')
|
||||
const arr = +new Date(st.arrival)
|
||||
// note that this can be an ICE train
|
||||
t.ok(isRoughlyEqual(14 * hour, +when, arr))
|
||||
}
|
||||
if (st.departure) {
|
||||
t.equal(typeof st.departure, 'string')
|
||||
const dep = +new Date(st.departure)
|
||||
t.ok(isRoughlyEqual(14 * hour, +when, dep))
|
||||
}
|
||||
}
|
||||
|
||||
t.ok(Array.isArray(v.frames))
|
||||
for (let f of v.frames) {
|
||||
assertValidStation(t, f.origin, true)
|
||||
assertValidStationProducts(t, f.origin.products)
|
||||
assertValidStation(t, f.destination, true)
|
||||
assertValidStationProducts(t, f.destination.products)
|
||||
t.equal(typeof f.t, 'number')
|
||||
}
|
||||
}
|
||||
t.end()
|
||||
}))
|
||||
|
|
Loading…
Add table
Reference in a new issue