mobiliteit.lu: fix national-train product bitmasks 🐛

This commit is contained in:
Jannis R 2020-11-25 16:22:28 +01:00 committed by Jannis Redmann
parent 850ec9484a
commit 54b7d2845b
3 changed files with 53 additions and 1 deletions

View file

@ -12,7 +12,7 @@ module.exports = [
{
id: 'national-train',
mode: 'train',
bitmasks: [6],
bitmasks: [2, 4],
name: 'national train (IC/RE/IRE)',
short: 'IC/RE/IRE',
default: true

View file

@ -19,6 +19,7 @@ require('./rejseplanen-trip')
require('./vsn-remarks')
require('./db-netz-remarks')
require('./vsn-departures')
require('./mobiliteit-lu-line')
require('./throttle')
require('./retry')

View file

@ -0,0 +1,51 @@
'use strict'
const test = require('tape')
const createClient = require('..')
const rawProfile = require('../p/mobiliteit-lu')
const client = createClient(rawProfile, 'public-transport/hafas-client:test')
const {profile} = client
const opt = {
linesOfStops: false, // parse & expose lines at the stop/station?
remarks: true,
}
test('parses a line correctly (mobiliteit.lu)', (t) => {
const rawLine = {
pid: 'L::1::IC::B1303038328::IC_1303038328::*',
name: 'IC 108',
number: '108',
icoX: 0,
cls: 2,
oprX: 0,
prodCtx: {
name: 'IC 108',
num: '108',
matchId: '108',
catOut: 'IC ',
catOutS: 'CIC',
catOutL: 'IC ',
catIn: 'CIC',
catCode: '1',
admin: 'C88---',
},
}
const ctx = {profile, opt}
const stop = profile.parseLine(ctx, rawLine)
t.deepEqual(stop, {
type: 'line',
id: 'ic-108',
fahrtNr: '108',
name: 'IC 108',
public: true,
adminCode: 'C88',
mode: 'train',
product: 'national-train',
})
t.end()
})