mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 07:40:59 +00:00
deb125bedc
The card names place search, address search and routing with what each answers and what is left of today's allowance. Each service is a tile with what is left as its figure, the day's use as a bar and used and limit as badges; the state, the kind of installation, a key from the environment and the time the count starts again sit as badges in the header. The sources add the terrain tiles the routes take their heights from.
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
TREK_API_SOURCES,
|
|
trekApiAddressFeatures,
|
|
trekApiFacts,
|
|
trekApiFields,
|
|
trekApiRoutingFeatures,
|
|
} from './trekApiModel';
|
|
|
|
// FE-TREKAPIMODEL-001 to FE-TREKAPIMODEL-004
|
|
|
|
const t = (key: string) => `<${key}>`;
|
|
|
|
describe('trekApiModel', () => {
|
|
it('FE-TREKAPIMODEL-001: lists the ten result fields in their order, translated', () => {
|
|
expect(trekApiFields(t)).toEqual([
|
|
'<places.formName>',
|
|
'<collections.coordinates>',
|
|
'<places.formCategory>',
|
|
'<places.formAddress>',
|
|
'<admin.trekApi.fieldPhone>',
|
|
'<common.email>',
|
|
'<places.formWebsite>',
|
|
'<places.formDescription>',
|
|
'<inspector.openingHours>',
|
|
'<admin.trekApi.fieldStableId>',
|
|
]);
|
|
});
|
|
|
|
it('FE-TREKAPIMODEL-002: leads with the three services, then the terms, each with a glyph', () => {
|
|
const facts = trekApiFacts(t);
|
|
expect(facts.map((f) => f.text)).toEqual([
|
|
'<admin.trekApi.factPlaces>',
|
|
'<admin.trekApi.factAddresses>',
|
|
'<admin.trekApi.factRouting>',
|
|
'<admin.trekApi.factNoKey>',
|
|
'<admin.trekApi.factOffline>',
|
|
'<admin.trekApi.factPrivacy>',
|
|
]);
|
|
for (const f of facts) expect(f.Icon).toBeTruthy();
|
|
});
|
|
|
|
it('FE-TREKAPIMODEL-003: names the data sources untranslated', () => {
|
|
expect(TREK_API_SOURCES).toEqual([
|
|
'Overture Maps Foundation',
|
|
'OpenStreetMap',
|
|
'Wikivoyage',
|
|
'Wikimedia',
|
|
'Mapzen Terrain Tiles',
|
|
]);
|
|
});
|
|
|
|
it('FE-TREKAPIMODEL-004: lists what the address search and the routing answer', () => {
|
|
expect(trekApiAddressFeatures(t)).toEqual([
|
|
'<admin.trekApi.addrStreets>',
|
|
'<admin.trekApi.addrTowns>',
|
|
'<admin.trekApi.addrReverse>',
|
|
'<admin.trekApi.addrLanguages>',
|
|
]);
|
|
expect(trekApiRoutingFeatures(t)).toEqual([
|
|
'<admin.trekApi.routeCar>',
|
|
'<admin.trekApi.routeBike>',
|
|
'<admin.trekApi.routeFoot>',
|
|
'<admin.trekApi.routeAvoid>',
|
|
'<admin.trekApi.routeElevation>',
|
|
]);
|
|
});
|
|
});
|