diff --git a/apps/web-next/src/server/bind-production.test.ts b/apps/web-next/src/server/bind-production.test.ts index 7453d70..1c7ba56 100644 --- a/apps/web-next/src/server/bind-production.test.ts +++ b/apps/web-next/src/server/bind-production.test.ts @@ -70,13 +70,12 @@ describe("bindAllProduction", () => { await bindAllProduction(makeDeps()); - const args = vi.mocked(bindProductionAuth).mock.calls[0]!; - // Args: (config, tracer, logger, bus, queue, realtime, realtimeRegistry) - expect(args[3]).toBeInstanceOf(PayloadJobsEventBus); - expect(args[4]).toBeInstanceOf(PayloadJobQueue); + const ctx = vi.mocked(bindProductionAuth).mock.calls[0]![0]; + expect(ctx.bus).toBeInstanceOf(PayloadJobsEventBus); + expect(ctx.queue).toBeInstanceOf(PayloadJobQueue); }); - it("forwards realtime and realtimeRegistry as 6th + 7th args to each production binder", async () => { + it("forwards realtime and realtimeRegistry as ctx.realtime + ctx.realtimeRegistry to each production binder", async () => { const { RecordingRealtimeBroadcaster } = await import("@repo/core-testing/instrumentation"); const { RealtimeHandlerRegistry } = await import("@repo/core-realtime"); const { bindAllProduction } = await import("./bind-production"); @@ -86,10 +85,9 @@ describe("bindAllProduction", () => { const realtimeRegistry = new RealtimeHandlerRegistry(); await bindAllProduction({ realtime, realtimeRegistry }); - const args = vi.mocked(bindProductionAuth).mock.calls[0]!; - // Args: (config, tracer, logger, bus, queue, realtime, realtimeRegistry) - expect(args[5]).toBe(realtime); - expect(args[6]).toBe(realtimeRegistry); + const ctx = vi.mocked(bindProductionAuth).mock.calls[0]![0]; + expect(ctx.realtime).toBe(realtime); + expect(ctx.realtimeRegistry).toBe(realtimeRegistry); }); }); @@ -107,13 +105,12 @@ describe("bindAllDevSeed", () => { await bindAllDevSeed(makeDeps()); - const args = vi.mocked(bindDevSeedAuth).mock.calls[0]!; - // Args: (tracer, logger, bus, queue, realtime, realtimeRegistry) - expect(args[2]).toBeInstanceOf(InMemoryEventBus); - expect(args[3]).toBeInstanceOf(InMemoryJobQueue); + const ctx = vi.mocked(bindDevSeedAuth).mock.calls[0]![0]; + expect(ctx.bus).toBeInstanceOf(InMemoryEventBus); + expect(ctx.queue).toBeInstanceOf(InMemoryJobQueue); }); - it("forwards realtime and realtimeRegistry as 5th + 6th args to each dev-seed binder", async () => { + it("forwards realtime and realtimeRegistry as ctx.realtime + ctx.realtimeRegistry to each dev-seed binder", async () => { const { RecordingRealtimeBroadcaster } = await import("@repo/core-testing/instrumentation"); const { RealtimeHandlerRegistry } = await import("@repo/core-realtime"); const { bindAllDevSeed } = await import("./bind-production"); @@ -123,10 +120,9 @@ describe("bindAllDevSeed", () => { const realtimeRegistry = new RealtimeHandlerRegistry(); await bindAllDevSeed({ realtime, realtimeRegistry }); - const args = vi.mocked(bindDevSeedAuth).mock.calls[0]!; - // Args: (tracer, logger, bus, queue, realtime, realtimeRegistry) - expect(args[4]).toBe(realtime); - expect(args[5]).toBe(realtimeRegistry); + const ctx = vi.mocked(bindDevSeedAuth).mock.calls[0]![0]; + expect(ctx.realtime).toBe(realtime); + expect(ctx.realtimeRegistry).toBe(realtimeRegistry); }); });