mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19: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: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: '18299',
|
id: '18299',
|
||||||
|
fahrtNr: '12345',
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
product: 'suburban',
|
product: 'suburban',
|
||||||
public: true,
|
public: true,
|
||||||
|
@ -113,6 +114,7 @@ The response may look like this:
|
||||||
line: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: '16441',
|
id: '16441',
|
||||||
|
fahrtNr: '54321',
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
product: 'suburban',
|
product: 'suburban',
|
||||||
public: true,
|
public: true,
|
||||||
|
@ -137,6 +139,7 @@ The response may look like this:
|
||||||
line: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: '19494',
|
id: '19494',
|
||||||
|
fahrtNr: '11111',
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
product: 'subway',
|
product: 'subway',
|
||||||
public: true,
|
public: true,
|
||||||
|
|
|
@ -139,6 +139,7 @@ The response may look like this:
|
||||||
line: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: '16845',
|
id: '16845',
|
||||||
|
fahrtNr: '12345',
|
||||||
name: 'S7',
|
name: 'S7',
|
||||||
public: true,
|
public: true,
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
|
|
|
@ -50,6 +50,7 @@ The response may look like this:
|
||||||
line: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: 's9',
|
id: 's9',
|
||||||
|
fahrtNr: '12345',
|
||||||
name: 'S9',
|
name: 'S9',
|
||||||
public: true,
|
public: true,
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
|
@ -122,6 +123,7 @@ The response may look like this:
|
||||||
line: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: 'm2',
|
id: 'm2',
|
||||||
|
fahrtNr: '54321',
|
||||||
name: 'M2',
|
name: 'M2',
|
||||||
public: true,
|
public: true,
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
|
|
|
@ -101,6 +101,7 @@ The response looked like this:
|
||||||
line: {
|
line: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: '18299',
|
id: '18299',
|
||||||
|
fahrtNr: '12345',
|
||||||
name: 'S9',
|
name: 'S9',
|
||||||
public: true,
|
public: true,
|
||||||
mode: 'train',
|
mode: 'train',
|
||||||
|
|
|
@ -15,6 +15,7 @@ const createParseLine = (profile, opt, {operators}) => {
|
||||||
const res = {
|
const res = {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
id: null,
|
id: null,
|
||||||
|
fahrtNr: p.prodCtx && p.prodCtx.num || null,
|
||||||
name: p.line || p.name,
|
name: p.line || p.name,
|
||||||
public: true
|
public: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,10 @@ const createValidateLine = (cfg) => {
|
||||||
|
|
||||||
const validateLine = (val, line, name = 'line') => {
|
const validateLine = (val, line, name = 'line') => {
|
||||||
defaultValidators.line(val, line, name)
|
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')
|
a.ok(validLineModes.includes(line.mode), name + '.mode is invalid')
|
||||||
}
|
}
|
||||||
return validateLine
|
return validateLine
|
||||||
|
|
Loading…
Add table
Reference in a new issue