refactor(admin): share the admin settings saves and the TREK API lists between desktop and phone

useAdminSettingsActions now holds the OIDC and file type saves and the five place switches, writing through the admin bag both shells already receive. trekApiModel keeps the TREK Places API fields, facts and sources the desktop card and the phone block list.
This commit is contained in:
Maurice
2026-10-09 10:57:37 +02:00
parent 8c8069e983
commit feb99ce398
8 changed files with 371 additions and 207 deletions
@@ -0,0 +1,39 @@
import { describe, expect, it } from 'vitest';
import { TREK_API_SOURCES, trekApiFacts, trekApiFields } from './trekApiModel';
// FE-TREKAPIMODEL-001 to FE-TREKAPIMODEL-003
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 four facts, each with a glyph', () => {
const facts = trekApiFacts(t);
expect(facts.map((f) => f.text)).toEqual([
'<admin.trekApi.factPlaces>',
'<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']);
});
});