2024-02-06 22:58:49 +01:00
|
|
|
import tap from 'tap';
|
|
|
|
import {parseOperator as parse} from '../../parse/operator.js';
|
2019-09-03 15:35:12 +02:00
|
|
|
|
2019-10-20 00:19:11 +02:00
|
|
|
const ctx = {
|
|
|
|
data: {},
|
|
|
|
opt: {},
|
2024-02-06 22:58:49 +01:00
|
|
|
profile: {},
|
|
|
|
};
|
2024-12-07 16:16:31 +00:00
|
|
|
|
2021-05-20 16:42:43 +01:00
|
|
|
tap.test('parses an operator correctly', (t) => {
|
2024-12-07 16:16:31 +00:00
|
|
|
const op = [{
|
2024-12-08 21:42:57 +00:00
|
|
|
kategorie: 'BEFÖRDERER',
|
|
|
|
key: 'BEF',
|
|
|
|
value: 'DB Fernverkehr AG',
|
|
|
|
}, {
|
|
|
|
kategorie: 'FAHRRADMITNAHME',
|
|
|
|
key: 'FR',
|
|
|
|
value: 'Bicycles conveyed - subject to reservation',
|
2024-12-07 16:16:31 +00:00
|
|
|
}];
|
2019-09-03 15:35:12 +02:00
|
|
|
|
2021-05-20 16:42:43 +01:00
|
|
|
t.same(parse(ctx, op), {
|
2019-09-03 15:35:12 +02:00
|
|
|
type: 'operator',
|
2024-12-07 16:16:31 +00:00
|
|
|
id: 'db-fernverkehr-ag',
|
|
|
|
name: 'DB Fernverkehr AG',
|
2024-02-06 22:58:49 +01:00
|
|
|
});
|
|
|
|
t.end();
|
|
|
|
});
|
2024-12-07 16:16:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
tap.test('parses nothing', (t) => {
|
|
|
|
const op = [{
|
2024-12-08 21:42:57 +00:00
|
|
|
kategorie: 'INFORMATION',
|
|
|
|
key: 'cB',
|
|
|
|
value: 'Tel. 0981-9714925, Anmeldung bis 90 Min. vor Abfahrt (Mo-So: 9-15 Uhr)',
|
2024-12-07 16:16:31 +00:00
|
|
|
}];
|
|
|
|
|
|
|
|
t.same(parse(ctx, op), null);
|
|
|
|
t.end();
|
|
|
|
});
|