mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 23:29:35 +02:00
27 lines
463 B
JavaScript
27 lines
463 B
JavaScript
|
'use strict'
|
||
|
|
||
|
const testLines = async (cfg) => {
|
||
|
const {
|
||
|
test: t,
|
||
|
fetchLines,
|
||
|
validate,
|
||
|
query,
|
||
|
} = cfg
|
||
|
|
||
|
const res = await fetchLines(query)
|
||
|
const {
|
||
|
lines,
|
||
|
realtimeDataUpdatedAt,
|
||
|
} = res
|
||
|
|
||
|
for (let i = 0; i < res.lines.length; i++) {
|
||
|
const l = res.lines[i]
|
||
|
const name = `res.lines[${i}]`
|
||
|
validate(t, l, 'line', name)
|
||
|
}
|
||
|
|
||
|
validate(t, realtimeDataUpdatedAt, 'realtimeDataUpdatedAt', 'res.realtimeDataUpdatedAt')
|
||
|
}
|
||
|
|
||
|
module.exports = testLines
|