test setup

This commit is contained in:
2026-01-04 00:39:17 +01:00
parent 5308d3ee61
commit 99092e2759
10 changed files with 638 additions and 106 deletions

View File

@@ -1,4 +1,5 @@
import { routes, routeMatchers } from '../../../apps/website/lib/routing/RouteConfig';
import { stableUuidFromSeedKey } from '../../../adapters/bootstrap/racing/SeedIdHelper';
export type RouteAccess = 'public' | 'auth' | 'admin' | 'sponsor';
export type RouteParams = Record<string, string>;
@@ -12,12 +13,13 @@ export interface WebsiteRouteDefinition {
}
export class WebsiteRouteManager {
// Generate IDs the same way the seed does for postgres compatibility
private static readonly IDs = {
LEAGUE: 'league-1',
DRIVER: 'driver-1',
TEAM: 'team-1',
RACE: 'race-1',
PROTEST: 'protest-1',
LEAGUE: stableUuidFromSeedKey('league-1'),
DRIVER: stableUuidFromSeedKey('driver-1'),
TEAM: stableUuidFromSeedKey('team-1'),
RACE: stableUuidFromSeedKey('race-1'),
PROTEST: stableUuidFromSeedKey('protest-1'),
} as const;
public resolvePathTemplate(pathTemplate: string, params: RouteParams = {}): string {
@@ -68,9 +70,11 @@ export class WebsiteRouteManager {
}
public getParamEdgeCases(): WebsiteRouteDefinition[] {
// Use non-existent UUIDs that will trigger 404 responses
const nonExistentId = '00000000-0000-0000-0000-000000000000';
return [
{ pathTemplate: '/races/[id]', params: { id: 'does-not-exist' }, access: 'public', allowNotFound: true },
{ pathTemplate: '/leagues/[id]', params: { id: 'does-not-exist' }, access: 'public', allowNotFound: true },
{ pathTemplate: '/races/[id]', params: { id: nonExistentId }, access: 'public', allowNotFound: true },
{ pathTemplate: '/leagues/[id]', params: { id: nonExistentId }, access: 'public', allowNotFound: true },
];
}