mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
fix tests point in time 💚
This commit is contained in:
parent
3c9c8433dc
commit
130ffeccf9
2 changed files with 7 additions and 8 deletions
|
@ -40,8 +40,8 @@
|
|||
"devDependencies": {
|
||||
"co": "^4.6.0",
|
||||
"db-stations": "^1.25.0",
|
||||
"floordate": "^3.0.0",
|
||||
"is-roughly-equal": "^0.1.0",
|
||||
"luxon": "^0.2.7",
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.8.0",
|
||||
"tape-promise": "^2.0.1",
|
||||
|
|
13
test/util.js
13
test/util.js
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const isRoughlyEqual = require('is-roughly-equal')
|
||||
const floor = require('floordate')
|
||||
const {DateTime} = require('luxon')
|
||||
|
||||
const assertValidStation = (t, s, coordsOptional = false) => {
|
||||
t.equal(typeof s.type, 'string')
|
||||
|
@ -80,13 +80,12 @@ const assertValidStopover = (t, s, coordsOptional = false) => {
|
|||
assertValidStation(t, s.station, coordsOptional)
|
||||
}
|
||||
|
||||
const minute = 60 * 1000
|
||||
const hour = 60 * minute
|
||||
const day = 24 * hour
|
||||
const week = 7 * day
|
||||
const hour = 60 * 60 * 1000
|
||||
const week = 7 * 24 * hour
|
||||
|
||||
// next Monday
|
||||
const when = new Date(+floor(new Date(), 'week') + week + 10 * hour)
|
||||
// next Monday 10 am
|
||||
const dt = DateTime.local().startOf('week').plus({weeks: 1, hours: 10})
|
||||
const when = new Date(dt.toISO())
|
||||
const isValidWhen = (w) => {
|
||||
const ts = +new Date(w)
|
||||
if (Number.isNaN(ts)) return false
|
||||
|
|
Loading…
Add table
Reference in a new issue