mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
parse line.fahrtNr, adapt tests ✅, adapt docs 📝
This commit is contained in:
parent
858fc209bb
commit
9257d3ad7d
6 changed files with 12 additions and 0 deletions
|
@ -86,6 +86,7 @@ The response may look like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: '18299',
|
||||
fahrtNr: '12345',
|
||||
mode: 'train',
|
||||
product: 'suburban',
|
||||
public: true,
|
||||
|
@ -113,6 +114,7 @@ The response may look like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: '16441',
|
||||
fahrtNr: '54321',
|
||||
mode: 'train',
|
||||
product: 'suburban',
|
||||
public: true,
|
||||
|
@ -137,6 +139,7 @@ The response may look like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: '19494',
|
||||
fahrtNr: '11111',
|
||||
mode: 'train',
|
||||
product: 'subway',
|
||||
public: true,
|
||||
|
|
|
@ -139,6 +139,7 @@ The response may look like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: '16845',
|
||||
fahrtNr: '12345',
|
||||
name: 'S7',
|
||||
public: true,
|
||||
mode: 'train',
|
||||
|
|
|
@ -50,6 +50,7 @@ The response may look like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: 's9',
|
||||
fahrtNr: '12345',
|
||||
name: 'S9',
|
||||
public: true,
|
||||
mode: 'train',
|
||||
|
@ -122,6 +123,7 @@ The response may look like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: 'm2',
|
||||
fahrtNr: '54321',
|
||||
name: 'M2',
|
||||
public: true,
|
||||
mode: 'train',
|
||||
|
|
|
@ -101,6 +101,7 @@ The response looked like this:
|
|||
line: {
|
||||
type: 'line',
|
||||
id: '18299',
|
||||
fahrtNr: '12345',
|
||||
name: 'S9',
|
||||
public: true,
|
||||
mode: 'train',
|
||||
|
|
|
@ -15,6 +15,7 @@ const createParseLine = (profile, opt, {operators}) => {
|
|||
const res = {
|
||||
type: 'line',
|
||||
id: null,
|
||||
fahrtNr: p.prodCtx && p.prodCtx.num || null,
|
||||
name: p.line || p.name,
|
||||
public: true
|
||||
}
|
||||
|
|
|
@ -82,6 +82,10 @@ const createValidateLine = (cfg) => {
|
|||
|
||||
const validateLine = (val, line, name = 'line') => {
|
||||
defaultValidators.line(val, line, name)
|
||||
|
||||
a.strictEqual(typeof line.fahrtNr, 'string', name + ' must be string')
|
||||
a.ok(line.fahrtNr, name + ' must not be empty')
|
||||
|
||||
a.ok(validLineModes.includes(line.mode), name + '.mode is invalid')
|
||||
}
|
||||
return validateLine
|
||||
|
|
Loading…
Add table
Reference in a new issue