From 0fbb880c82c4c4bbe0a64ea899000c71913fd919 Mon Sep 17 00:00:00 2001 From: danijel-lf Date: Thu, 28 May 2026 22:41:10 +0200 Subject: [PATCH] fix(web-next): correct idempotency test to use bindAll not bindAllProduction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bindAllProduction has no idempotency guard — the promise cache lives in bindAll. Test was calling the wrong function, causing the spy to fire twice. --- apps/web-next/src/server/bind-production.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web-next/src/server/bind-production.test.ts b/apps/web-next/src/server/bind-production.test.ts index 4c5b52c..2b153a9 100644 --- a/apps/web-next/src/server/bind-production.test.ts +++ b/apps/web-next/src/server/bind-production.test.ts @@ -69,12 +69,13 @@ describe("bindAllProduction", () => { expect(bindProductionMedia).toHaveBeenCalledOnce(); }); - it("is idempotent — second call does not re-bind", async () => { - const { bindAllProduction } = await import("./bind-production"); + it("is idempotent via bindAll — second call does not re-bind", async () => { + vi.stubEnv("NODE_ENV", "production"); + const { bindAll } = await import("./bind-production"); const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); - await bindAllProduction(); - await bindAllProduction(); + await bindAll(); + await bindAll(); expect(bindProductionBlog).toHaveBeenCalledOnce(); });