tests: fix isRoughlyEqual calls

This commit is contained in:
Jannis R 2018-06-07 12:59:50 +02:00
parent a7c550ab69
commit 0136189aa4
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 16 additions and 16 deletions

View file

@ -56,8 +56,8 @@ const isJungfernheide = (s) => {
(s.id === '008011167' || s.id === jungfernh) && (s.id === '008011167' || s.id === jungfernh) &&
s.name === 'Berlin Jungfernheide' && s.name === 'Berlin Jungfernheide' &&
s.location && s.location &&
isRoughlyEqual(s.location.latitude, 52.530408, .0005) && isRoughlyEqual(.0005, s.location.latitude, 52.530408) &&
isRoughlyEqual(s.location.longitude, 13.299424, .0005) isRoughlyEqual(.0005, s.location.longitude, 13.299424)
} }
const assertIsJungfernheide = (t, s) => { const assertIsJungfernheide = (t, s) => {
@ -65,8 +65,8 @@ const assertIsJungfernheide = (t, s) => {
t.ok(s.id === '008011167' || s.id === jungfernh, 'id should be 8011167') t.ok(s.id === '008011167' || s.id === jungfernh, 'id should be 8011167')
t.equal(s.name, 'Berlin Jungfernheide') t.equal(s.name, 'Berlin Jungfernheide')
t.ok(s.location) t.ok(s.location)
t.ok(isRoughlyEqual(s.location.latitude, 52.530408, .0005)) t.ok(isRoughlyEqual(.0005, s.location.latitude, 52.530408))
t.ok(isRoughlyEqual(s.location.longitude, 13.299424, .0005)) t.ok(isRoughlyEqual(.0005, s.location.longitude, 13.299424))
} }
// todo: DRY with assertValidStationProducts // todo: DRY with assertValidStationProducts

View file

@ -40,8 +40,8 @@ const isMagdeburgHbf = s => {
(s.id === '8010224' || s.id === '008010224') && (s.id === '8010224' || s.id === '008010224') &&
s.name === 'Magdeburg Hbf' && s.name === 'Magdeburg Hbf' &&
s.location && s.location &&
isRoughlyEqual(s.location.latitude, 52.130352, 0.001) && isRoughlyEqual(.001, s.location.latitude, 52.130352) &&
isRoughlyEqual(s.location.longitude, 11.626891, 0.001) isRoughlyEqual(.001, s.location.longitude, 11.626891)
) )
} }
@ -50,8 +50,8 @@ const assertIsMagdeburgHbf = (t, s) => {
t.ok(s.id === '8010224' || s.id === '008010224', 'id should be 8010224') t.ok(s.id === '8010224' || s.id === '008010224', 'id should be 8010224')
t.equal(s.name, 'Magdeburg Hbf') t.equal(s.name, 'Magdeburg Hbf')
t.ok(s.location) t.ok(s.location)
t.ok(isRoughlyEqual(s.location.latitude, 52.130352, 0.001)) t.ok(isRoughlyEqual(.001, s.location.latitude, 52.130352))
t.ok(isRoughlyEqual(s.location.longitude, 11.626891, 0.001)) t.ok(isRoughlyEqual(.001, s.location.longitude, 11.626891))
} }
// todo: DRY with assertValidStationProducts // todo: DRY with assertValidStationProducts

View file

@ -43,8 +43,8 @@ const isKielHbf = (s) => {
(s.id === '8000199') && (s.id === '8000199') &&
s.name === 'Kiel Hbf' && s.name === 'Kiel Hbf' &&
s.location && s.location &&
isRoughlyEqual(s.location.latitude, 54.314982, .0005) && isRoughlyEqual(.0005, s.location.latitude, 54.314982) &&
isRoughlyEqual(s.location.longitude, 10.131976, .0005) isRoughlyEqual(.0005, s.location.longitude, 10.131976)
} }
const assertIsKielHbf = (t, s) => { const assertIsKielHbf = (t, s) => {
@ -52,8 +52,8 @@ const assertIsKielHbf = (t, s) => {
t.ok(s.id === '8000199', 'id should be 8000199') t.ok(s.id === '8000199', 'id should be 8000199')
t.equal(s.name, 'Kiel Hbf') t.equal(s.name, 'Kiel Hbf')
t.ok(s.location) t.ok(s.location)
t.ok(isRoughlyEqual(s.location.latitude, 54.314982, .0005)) t.ok(isRoughlyEqual(.0005, s.location.latitude, 54.314982))
t.ok(isRoughlyEqual(s.location.longitude, 10.131976, .0005)) t.ok(isRoughlyEqual(.0005, s.location.longitude, 10.131976))
} }
// todo: DRY with assertValidStationProducts // todo: DRY with assertValidStationProducts

View file

@ -60,8 +60,8 @@ const isSalzburgHbf = (s) => {
(s.id === '008100002' || s.id === '8100002') && (s.id === '008100002' || s.id === '8100002') &&
s.name === 'Salzburg Hbf' && s.name === 'Salzburg Hbf' &&
s.location && s.location &&
isRoughlyEqual(s.location.latitude, 47.812851, .0005) && isRoughlyEqual(.0005, s.location.latitude, 47.812851) &&
isRoughlyEqual(s.location.longitude, 13.045604, .0005) isRoughlyEqual(.0005, s.location.longitude, 13.045604)
} }
const assertIsSalzburgHbf = (t, s) => { const assertIsSalzburgHbf = (t, s) => {
@ -69,8 +69,8 @@ const assertIsSalzburgHbf = (t, s) => {
t.ok(s.id === '008100002' || s.id === '8100002', 'id should be 8100002') t.ok(s.id === '008100002' || s.id === '8100002', 'id should be 8100002')
t.equal(s.name, 'Salzburg Hbf') t.equal(s.name, 'Salzburg Hbf')
t.ok(s.location) t.ok(s.location)
t.ok(isRoughlyEqual(s.location.latitude, 47.812851, .0005)) t.ok(isRoughlyEqual(.0005, s.location.latitude, 47.812851))
t.ok(isRoughlyEqual(s.location.longitude, 13.045604, .0005)) t.ok(isRoughlyEqual(.0005, s.location.longitude, 13.045604))
} }
// todo: DRY with assertValidStationProducts // todo: DRY with assertValidStationProducts