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:
@@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user