fix(web-next): correct idempotency test to use bindAll not bindAllProduction

bindAllProduction has no idempotency guard — the promise cache lives in
bindAll. Test was calling the wrong function, causing the spy to fire
twice.
This commit is contained in:
danijel-lf
2026-05-28 22:41:10 +02:00
parent 5b74939a51
commit 0fbb880c82

View File

@@ -69,12 +69,13 @@ describe("bindAllProduction", () => {
expect(bindProductionMedia).toHaveBeenCalledOnce(); expect(bindProductionMedia).toHaveBeenCalledOnce();
}); });
it("is idempotent — second call does not re-bind", async () => { it("is idempotent via bindAll — second call does not re-bind", async () => {
const { bindAllProduction } = await import("./bind-production"); vi.stubEnv("NODE_ENV", "production");
const { bindAll } = await import("./bind-production");
const { bindProductionBlog } = const { bindProductionBlog } =
await import("@repo/blog/di/bind-production"); await import("@repo/blog/di/bind-production");
await bindAllProduction(); await bindAll();
await bindAllProduction(); await bindAll();
expect(bindProductionBlog).toHaveBeenCalledOnce(); expect(bindProductionBlog).toHaveBeenCalledOnce();
}); });