Files
TREK/client/src/repo/atlasPluginLayersRepo.test.ts
T
Maurice 9018ee8980 test(atlas): cover the new Atlas from engine to hub views
SonarCloud measured 16.9% coverage on this PR's new code. Tests now cover the WebGL globe engine (boot, caching, input, camera, regions, prefetch) and renderer (against a fake WebGL2 context that reads the real shaders), the paint, labels, sky and pins, the central useAtlasGlobe hook and the hub hooks, the snapshot, account queue and Atlas repos, every desktop and phone hub view, the server's people, flights and mesh routes, the shared badge rules, and the new view transition, warm bags and kept planner maps.
2026-11-29 10:21:28 +01:00

25 lines
1.2 KiB
TypeScript

// FE-ATLAS2-DATA-120 to FE-ATLAS2-DATA-122: the plugin tints of the Atlas, fail-safe.
import { http, HttpResponse } from 'msw';
import { describe, expect, it } from 'vitest';
import { server } from '../../tests/helpers/msw/server';
import { atlasPluginLayersRepo } from './atlasPluginLayersRepo';
describe('atlasPluginLayersRepo', () => {
it('FE-ATLAS2-DATA-120: the layers the plugins answer are handed back', async () => {
const layers = [{ pluginId: 'p', id: 'l', name: 'Layer', countries: [{ code: 'DE', tone: 'success' }] }];
server.use(http.get('/api/atlas-layers', () => HttpResponse.json({ layers })));
expect(await atlasPluginLayersRepo.layers()).toEqual(layers);
});
it('FE-ATLAS2-DATA-121: an answer without layers reads as none', async () => {
server.use(http.get('/api/atlas-layers', () => HttpResponse.json({})));
expect(await atlasPluginLayersRepo.layers()).toEqual([]);
});
it('FE-ATLAS2-DATA-122: a failing read shows no layers instead of throwing', async () => {
server.use(http.get('/api/atlas-layers', () => HttpResponse.json({ error: 'boom' }, { status: 500 })));
expect(await atlasPluginLayersRepo.layers()).toEqual([]);
});
});