adapt tests to 1e13cf1

This commit is contained in:
Jannis R 2019-01-16 22:05:21 +08:00
parent 1e13cf15ae
commit b99ceb21fb
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
7 changed files with 30 additions and 53 deletions

View file

@ -220,8 +220,7 @@ test('locations named "Capitol"', co(function*(t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((l) => {
const trim = str => str && str.replace(/^0+/, '')
return l.station && trim(l.station.id) === capitol591 || trim(l.id) === capitol591
return l.station && l.station.id === capitol591 || l.id === capitol591
}))
t.end()

View file

@ -79,8 +79,8 @@ const berlinHbf = '8011160'
const münchenHbf = '8000261'
const jungfernheide = '8011167'
const blnSchwedterStr = '732652'
const westhafen = '008089116'
const wedding = '008089131'
const westhafen = '8089116'
const wedding = '8089131'
const württembergallee = '731084'
const regensburgHbf = '8000309'
const blnOstbahnhof = '8010255'
@ -333,8 +333,7 @@ test('nearby Berlin Jungfernheide', co(function* (t) {
t.equal(nearby.length, 2)
const s0 = nearby[0]
// todo: trim IDs
t.ok(s0.id === '008011167' || s0.id === jungfernheide)
t.equal(s0.id, jungfernheide)
t.equal(s0.name, 'Berlin Jungfernheide')
t.ok(isRoughlyEqual(.0005, s0.location.latitude, 52.530408))
t.ok(isRoughlyEqual(.0005, s0.location.longitude, 13.299424))
@ -352,11 +351,7 @@ test('locations named Jungfernheide', co(function* (t) {
validate(t, locations, 'locations', 'locations')
t.ok(locations.length <= 10)
t.ok(locations.some((l) => {
// todo: trim IDs
if (l.station) {
if (l.station.id === '008011167' || l.station.id === jungfernheide) return true
}
return l.id === '008011167' || l.id === jungfernheide
return l.station && l.station.id === jungfernheide || l.id === jungfernheide
}), 'Jungfernheide not found')
t.end()

View file

@ -42,9 +42,9 @@ const client = createClient(insaProfile, 'public-transport/hafas-client:test')
const magdeburgHbf = '8010224'
const magdeburgBuckau = '8013456'
const leiterstr = '7464'
const hasselbachplatzSternstrasse = '000006545'
const stendal = '008010334'
const dessau = '008010077'
const hasselbachplatzSternstrasse = '6545'
const stendal = '8010334'
const dessau = '8010077'
const universitaet = '19686'
test('journeys  Magdeburg Hbf to Magdeburg-Buckau', co(function* (t) {
@ -139,7 +139,7 @@ test('journeys: via works with detour', co(function* (t) {
test: t,
journeys,
validate,
detourIds: ['8010077', dessau] // todo: trim IDs
detourIds: [dessau]
})
t.end()
}))
@ -245,11 +245,7 @@ test('locations named Magdeburg', co(function*(t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((l) => {
// todo: trim IDs
if (l.station) {
if (l.station.id === '000007480' || l.station.id === nordpark) return true
}
return l.id === '000007480' || l.id === nordpark
return l.station && l.station.id === nordpark || l.id === nordpark
}))
t.end()

View file

@ -151,9 +151,9 @@ test('Salzburg Hbf to Albertina', co(function* (t) {
test('journeys: via works with detour', co(function* (t) {
// Going from Stephansplatz to Schottenring via Donauinsel without detour
// is currently impossible. We check if the routing engine computes a detour.
const stephansplatz = '001390167'
const schottenring = '001390163'
const donauinsel = '001392277'
const stephansplatz = '1390167'
const schottenring = '1390163'
const donauinsel = '1392277'
const donauinselPassed = '922001'
const journeys = yield client.journeys(stephansplatz, schottenring, {
via: donauinsel,
@ -174,9 +174,9 @@ test('journeys: via works with detour', co(function* (t) {
test('journeys: via works without detour', co(function* (t) {
// When going from Karlsplatz to Praterstern via Museumsquartier, there is
// *no need* to change trains / no need for a "detour".
const karlsplatz = '001390461'
const praterstern = '001290201'
const museumsquartier = '001390171'
const karlsplatz = '1390461'
const praterstern = '1290201'
const museumsquartier = '1390171'
const museumsquartierPassed = '901014'
const journeys = yield client.journeys(karlsplatz, praterstern, {
@ -316,7 +316,7 @@ test('nearby Salzburg Hbf', co(function* (t) {
t.equal(nearby.length, 5)
const s = nearby[0]
t.ok(s.id === '008100002' || s.id === '8100002', 'id should be 8100002')
t.equal(s.id, salzburgHbf, 'id should be ' + salzburgHbf)
t.equal(s.name, 'Salzburg Hbf')
t.ok(isRoughlyEqual(.0005, s.location.latitude, 47.812851))
t.ok(isRoughlyEqual(.0005, s.location.longitude, 13.045604))
@ -337,11 +337,7 @@ test('locations named Salzburg', co(function* (t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((s) => {
// todo: trim IDs
if (s.station) {
if (s.station.id === '008100002' || s.station.id === '8100002') return true
}
return s.id === '008100002' || s.id === '8100002'
return s.station && s.station.id === salzburgHbf || s.id === salzburgHbf
}))
t.end()

View file

@ -106,7 +106,7 @@ test('Saarbrücken Hbf to Schlossberghöhlen', co(function * (t) {
latitude: 49.32071,
longitude: 7.343764,
name: 'Homburg, Schlossberghöhlen',
id: '009000185'
id: '9000185'
}
const journeys = yield client.journeys(saarbrueckenHbf, schlossberghoehlen, {
results: 3, departure: when
@ -125,9 +125,9 @@ test('Saarbrücken Hbf to Schlossberghöhlen', co(function * (t) {
test.skip('journeys: via works with detour', co(function* (t) {
// Going from Stephansplatz to Schottenring via Donauinsel without detour
// is currently impossible. We check if the routing engine computes a detour.
const stephansplatz = '001390167'
const schottenring = '001390163'
const donauinsel = '001392277'
const stephansplatz = '1390167'
const schottenring = '1390163'
const donauinsel = '1392277'
const donauinselPassed = '922001'
const journeys = yield client.journeys(stephansplatz, schottenring, {
via: donauinsel,
@ -148,9 +148,9 @@ test.skip('journeys: via works with detour', co(function* (t) {
test.skip('journeys: via works without detour', co(function* (t) {
// When going from Karlsplatz to Praterstern via Museumsquartier, there is
// *no need* to change trains / no need for a "detour".
const karlsplatz = '001390461'
const praterstern = '001290201'
const museumsquartier = '001390171'
const karlsplatz = '1390461'
const praterstern = '1290201'
const museumsquartier = '1390171'
const museumsquartierPassed = '901014'
const journeys = yield client.journeys(karlsplatz, praterstern, {
@ -275,7 +275,7 @@ test('nearby Saarbrücken Hbf', co(function * (t) {
t.equal(nearby.length, 5)
const s = nearby[0]
t.ok(s.id === '00' + saarbrueckenHbf || s.id === saarbrueckenHbf, 'id should be ' + saarbrueckenHbf)
t.equal(s.id, saarbrueckenHbf, 'id should be ' + saarbrueckenHbf)
t.equal(s.name, 'Saarbrücken Hbf')
t.ok(isRoughlyEqual(0.0005, s.location.latitude, 49.241066))
t.ok(isRoughlyEqual(0.0005, s.location.longitude, 6.991019))
@ -296,11 +296,7 @@ test('locations named Saarbrücken', co(function * (t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((s) => {
// todo: trim IDs
if (s.station) {
if (s.station.id === '00' + saarbrueckenHbf || s.station.id === saarbrueckenHbf) return true
}
return s.id === '00' + saarbrueckenHbf || s.id === saarbrueckenHbf
return s.station && s.station.id === saarbrueckenHbf || s.id === saarbrueckenHbf
}))
t.end()

View file

@ -236,8 +236,7 @@ test('locations named "Nationaltheater"', co(function*(t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((l) => {
const trim = str => str && str.replace(/^0+/, '')
return l.station && trim(l.station.id) === nationaltheater || trim(l.id) === nationaltheater
return l.station && l.station.id === nationaltheater || l.id === nationaltheater
}))
t.end()

View file

@ -132,7 +132,7 @@ test.skip('journeys: via works with detour', co(function* (t) {
test: t,
journeys,
validate,
detourIds: ['8010077', dessau] // todo: trim IDs
detourIds: [dessau]
})
t.end()
}))
@ -238,11 +238,7 @@ test.skip('locations named Magdeburg', co(function*(t) {
t.ok(locations.find(s => s.type === 'stop' || s.type === 'station'))
t.ok(locations.find(s => s.id && s.name)) // POIs
t.ok(locations.some((l) => {
// todo: trim IDs
if (l.station) {
if (l.station.id === '008010224' || l.station.id === bremenHbf) return true
}
return l.id === '008010224' || l.id === bremenHbf
return l.station && l.station.id === bremenHbf || l.id === bremenHbf
}))
t.end()