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