mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
6ce15157a1
createTestModule (tests/helpers/test-module.ts) builds a Nest testing module of the domain modules under test over the suite's test db, with a FakeRealtimeService and provider overrides for the collaborators a suite controls. bootTestApp (tests/helpers/test-app.ts) boots AppModule once per file, with recording realtime, fixture storage and an offline geocoder, and the MCP harness takes McpRegistryService from it inside a request context instead of hand-wiring roughly eighty services. The days, day removal and day notes service suites take their subjects from DaysModule and DayNotesModule.
21 lines
999 B
TypeScript
21 lines
999 B
TypeScript
import { McpRegistryService, type McpRegistry } from '../../src/nest-mcp';
|
|
import type { RealtimeService } from '../../src/nest/realtime/realtime.service';
|
|
import { bootTestApp } from './test-app';
|
|
|
|
/**
|
|
* The MCP registry the MCP harness attaches, taken from the booted
|
|
* application container (tests/helpers/test-app.ts): the same
|
|
* McpRegistryService production builds, with every @McpController the
|
|
* container discovers and the policy AppModule hands McpModule.forRoot (the
|
|
* access policy, the demo tool gate, the error mapper).
|
|
*
|
|
* It used to be a hand-wired copy of that graph, one positional constructor
|
|
* call per service, which every new dependency broke. Booting the container
|
|
* once per file costs about what building the copy did per harness.
|
|
*
|
|
* Pass the suite's FakeRealtimeService to assert on broadcasts.
|
|
*/
|
|
export async function createMcpTestRegistry(realtime?: RealtimeService): Promise<McpRegistry> {
|
|
return (await bootTestApp(realtime)).get(McpRegistryService);
|
|
}
|