BVG/VBB: fix nearby() integration/E2E test

This commit is contained in:
Jannis R 2021-10-19 00:35:45 +02:00
parent 0148a5bcbc
commit 102c4bf2a5
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 12 additions and 4 deletions

View file

@ -367,7 +367,10 @@ tap.test('nearby', async (t) => {
type: 'location', type: 'location',
latitude: 52.4873452, latitude: 52.4873452,
longitude: 13.3310411 longitude: 13.3310411
}, {distance: 300}) }, {
// Even though HAFAS reports Landhausstr. to be 179m, we have to pass way more here. 🙄
distance: 600,
})
validate(t, nearby, 'locations', 'nearby') validate(t, nearby, 'locations', 'nearby')
@ -376,7 +379,8 @@ tap.test('nearby', async (t) => {
t.ok(nearby[0].distance > 0) t.ok(nearby[0].distance > 0)
t.ok(nearby[0].distance < 100) t.ok(nearby[0].distance < 100)
t.equal(nearby[1].id, landhausstr) const res = nearby.find(s => s.id === landhausstr)
t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`)
t.equal(nearby[1].name, 'Landhausstr.') t.equal(nearby[1].name, 'Landhausstr.')
t.ok(nearby[1].distance > 100) t.ok(nearby[1].distance > 100)
t.ok(nearby[1].distance < 200) t.ok(nearby[1].distance < 200)

View file

@ -319,7 +319,10 @@ tap.test('nearby', async (t) => {
type: 'location', type: 'location',
latitude: 52.4873452, latitude: 52.4873452,
longitude: 13.3310411 longitude: 13.3310411
}, {distance: 250}) }, {
// Even though HAFAS reports Landhausstr. to be 179m, we have to pass way more here. 🙄
distance: 600,
})
validate(t, nearby, 'locations', 'nearby') validate(t, nearby, 'locations', 'nearby')
@ -328,7 +331,8 @@ tap.test('nearby', async (t) => {
t.ok(nearby[0].distance > 0) t.ok(nearby[0].distance > 0)
t.ok(nearby[0].distance < 100) t.ok(nearby[0].distance < 100)
t.equal(nearby[1].id, landhausstr) const res = nearby.find(s => s.id === landhausstr)
t.ok(res, `Landhausstr. ${landhausstr} is not among the nearby stops`)
t.equal(nearby[1].name, 'Landhausstr.') t.equal(nearby[1].name, 'Landhausstr.')
t.ok(nearby[1].distance > 100) t.ok(nearby[1].distance > 100)
t.ok(nearby[1].distance < 200) t.ok(nearby[1].distance < 200)