mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
fix tests 💚
This commit is contained in:
parent
3ade1af7a2
commit
f6c824eecb
1 changed files with 21 additions and 0 deletions
21
test/lib/arrivals.js
Normal file
21
test/lib/arrivals.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const co = require('./co')
|
||||||
|
|
||||||
|
const testArrivals = co(function* (cfg) {
|
||||||
|
const {test: t, arrivals: arrs, validate, id} = cfg
|
||||||
|
|
||||||
|
validate(t, arrs, 'arrivals', 'arrivals')
|
||||||
|
t.ok(arrs.length > 0, 'must be >0 arrivals')
|
||||||
|
for (let i = 0; i < arrs.length; i++) {
|
||||||
|
const dep = arrs[i]
|
||||||
|
const name = `arrs[${i}]`
|
||||||
|
|
||||||
|
t.equal(dep.station.id, id, name + '.station.id is invalid')
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo: move into arrivals validator
|
||||||
|
t.deepEqual(arrs, arrs.sort((a, b) => t.when > b.when))
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = testArrivals
|
Loading…
Add table
Reference in a new issue