mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
Add an admin switch for place enrichment
Reads fail-open, unlike the three older places_* switches. Those read === 'true', which is why migration 185 had to backfill a row on every existing install; there is nothing here that warrants repeating that. The three hand-rolled toggles next to it move to ToggleSwitch while I am in there - they were bare buttons with an inline transform and no aria-pressed or label, so a screen reader could not tell their state.
This commit is contained in:
@@ -505,6 +505,23 @@ describe('admin.bridge', () => {
|
||||
|
||||
describe('admin quirk fixes (post-fold)', () => {
|
||||
|
||||
it('ADMIN-SVC-071b — places enrichment is fail-OPEN, so no migration is needed for it', () => {
|
||||
// Deliberately the other way round from the three above: unset means on, and
|
||||
// PlaceEnrichmentService reads the same setting the same way. Reading it
|
||||
// fail-closed here would show "off" in the panel while the feature ran.
|
||||
expect(svc.getPlacesEnrich()).toEqual({ enabled: true });
|
||||
|
||||
svc.updatePlacesEnrich(false);
|
||||
expect(svc.getPlacesEnrich()).toEqual({ enabled: false });
|
||||
|
||||
svc.updatePlacesEnrich(true);
|
||||
expect(svc.getPlacesEnrich()).toEqual({ enabled: true });
|
||||
|
||||
// Only the literal 'false' switches it off; anything else stays on.
|
||||
testDb.prepare("INSERT OR REPLACE INTO app_settings (key, value) VALUES ('places_enrich_enabled', 'garbage')").run();
|
||||
expect(svc.getPlacesEnrich()).toEqual({ enabled: true });
|
||||
});
|
||||
|
||||
it('ADMIN-SVC-072 — updateUser rejects an empty username/email instead of silently no-opping', () => {
|
||||
const { user } = createUser(testDb);
|
||||
expect(updateUser(String(user.id), { username: '' }) as any).toMatchObject({ status: 400, error: 'Username cannot be empty' });
|
||||
|
||||
Reference in New Issue
Block a user