From 318dc05b6e9dd338a4930042f07282454a34aab9 Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Wed, 13 May 2026 10:22:17 +0200 Subject: [PATCH] refactor: strip residual R-number test descriptions + Lazar URL from ADR-013 --- .../src/server/bind-production.test.ts | 89 ++++++++++++------- .../adr-013-input-output-unification.md | 1 - .../src/setup/no-instrumentation.test.ts | 8 +- 3 files changed, 65 insertions(+), 33 deletions(-) diff --git a/apps/web-next/src/server/bind-production.test.ts b/apps/web-next/src/server/bind-production.test.ts index af13334..fd84693 100644 --- a/apps/web-next/src/server/bind-production.test.ts +++ b/apps/web-next/src/server/bind-production.test.ts @@ -1,19 +1,36 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; vi.mock("@repo/core-cms", () => ({ default: Promise.resolve({}) })); -vi.mock("payload", () => ({ getPayload: vi.fn(async () => ({ jobs: { queue: vi.fn() } })) })); -vi.mock("@repo/blog/di/bind-production", () => ({ bindProductionBlog: vi.fn() })); -vi.mock("@repo/auth/di/bind-production", () => ({ bindProductionAuth: vi.fn() })); -vi.mock("@repo/marketing-pages/di/bind-production", () => ({ bindProductionMarketingPages: vi.fn() })); -vi.mock("@repo/navigation/di/bind-production", () => ({ bindProductionNavigation: vi.fn() })); -vi.mock("@repo/media/di/bind-production", () => ({ bindProductionMedia: vi.fn() })); +vi.mock("payload", () => ({ + getPayload: vi.fn(async () => ({ jobs: { queue: vi.fn() } })), +})); +vi.mock("@repo/blog/di/bind-production", () => ({ + bindProductionBlog: vi.fn(), +})); +vi.mock("@repo/auth/di/bind-production", () => ({ + bindProductionAuth: vi.fn(), +})); +vi.mock("@repo/marketing-pages/di/bind-production", () => ({ + bindProductionMarketingPages: vi.fn(), +})); +vi.mock("@repo/navigation/di/bind-production", () => ({ + bindProductionNavigation: vi.fn(), +})); +vi.mock("@repo/media/di/bind-production", () => ({ + bindProductionMedia: vi.fn(), +})); vi.mock("@repo/blog/di/bind-dev-seed", () => ({ bindDevSeedBlog: vi.fn() })); vi.mock("@repo/auth/di/bind-dev-seed", () => ({ bindDevSeedAuth: vi.fn() })); -vi.mock("@repo/marketing-pages/di/bind-dev-seed", () => ({ bindDevSeedMarketingPages: vi.fn() })); -vi.mock("@repo/navigation/di/bind-dev-seed", () => ({ bindDevSeedNavigation: vi.fn() })); +vi.mock("@repo/marketing-pages/di/bind-dev-seed", () => ({ + bindDevSeedMarketingPages: vi.fn(), +})); +vi.mock("@repo/navigation/di/bind-dev-seed", () => ({ + bindDevSeedNavigation: vi.fn(), +})); vi.mock("@repo/media/di/bind-dev-seed", () => ({ bindDevSeedMedia: vi.fn() })); vi.mock("@repo/core-shared/instrumentation", async (importOriginal) => { - const actual = await importOriginal(); + const actual = + await importOriginal(); const mockedOtel = vi.fn(actual.bindOtelInstrumentation); return { ...actual, @@ -32,11 +49,16 @@ describe("bindAllProduction", () => { it("binds all five feature production repos", async () => { const { bindAllProduction } = await import("./bind-production"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); - const { bindProductionAuth } = await import("@repo/auth/di/bind-production"); - const { bindProductionMarketingPages } = await import("@repo/marketing-pages/di/bind-production"); - const { bindProductionNavigation } = await import("@repo/navigation/di/bind-production"); - const { bindProductionMedia } = await import("@repo/media/di/bind-production"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); + const { bindProductionAuth } = + await import("@repo/auth/di/bind-production"); + const { bindProductionMarketingPages } = + await import("@repo/marketing-pages/di/bind-production"); + const { bindProductionNavigation } = + await import("@repo/navigation/di/bind-production"); + const { bindProductionMedia } = + await import("@repo/media/di/bind-production"); await bindAllProduction(); @@ -49,7 +71,8 @@ describe("bindAllProduction", () => { it("is idempotent — second call does not re-bind", async () => { const { bindAllProduction } = await import("./bind-production"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); await bindAllProduction(); await bindAllProduction(); expect(bindProductionBlog).toHaveBeenCalledOnce(); @@ -57,7 +80,8 @@ describe("bindAllProduction", () => { it("passes a Payload-backed queue to each per-feature binder", async () => { const { bindAllProduction } = await import("./bind-production"); - const { bindProductionAuth } = await import("@repo/auth/di/bind-production"); + const { bindProductionAuth } = + await import("@repo/auth/di/bind-production"); const { PayloadJobQueue } = await import("@repo/core-shared/jobs"); await bindAllProduction(); @@ -103,7 +127,8 @@ describe("bindAll dispatcher", () => { vi.stubEnv("NODE_ENV", "production"); // even in production, dev seed wins const { bindAll } = await import("./bind-production"); const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); await bindAll(); @@ -114,7 +139,8 @@ describe("bindAll dispatcher", () => { it("NODE_ENV='production' (no override) → dispatches to bindAllProduction", async () => { vi.stubEnv("NODE_ENV", "production"); const { bindAll } = await import("./bind-production"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed"); await bindAll(); @@ -127,7 +153,8 @@ describe("bindAll dispatcher", () => { vi.stubEnv("NODE_ENV", "development"); const { bindAll } = await import("./bind-production"); const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); await bindAll(); @@ -139,7 +166,8 @@ describe("bindAll dispatcher", () => { vi.stubEnv("USE_DEV_SEED", "false"); vi.stubEnv("NODE_ENV", "production"); const { bindAll } = await import("./bind-production"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed"); await bindAll(); @@ -164,13 +192,12 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => { // to the same spy as bindOtelInstrumentation. Assertions against either name // verify the same call, which also validates the deprecation alias is wired. - it("DSN absent → bindNoopInstrumentation regardless of NODE_ENV (R48)", async () => { + it("DSN absent → bindNoopInstrumentation regardless of NODE_ENV", async () => { vi.stubEnv("WEB_NEXT_SENTRY_DSN", ""); vi.stubEnv("NODE_ENV", "production"); const { bindAll } = await import("./bind-production"); - const { bindNoopInstrumentation, bindOtelInstrumentation } = await import( - "@repo/core-shared/instrumentation" - ); + const { bindNoopInstrumentation, bindOtelInstrumentation } = + await import("@repo/core-shared/instrumentation"); await bindAll(); @@ -182,9 +209,8 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => { vi.stubEnv("WEB_NEXT_SENTRY_DSN", "https://x@y/1"); vi.stubEnv("NODE_ENV", "development"); const { bindAll } = await import("./bind-production"); - const { bindNoopInstrumentation, bindOtelInstrumentation } = await import( - "@repo/core-shared/instrumentation" - ); + const { bindNoopInstrumentation, bindOtelInstrumentation } = + await import("@repo/core-shared/instrumentation"); await bindAll(); @@ -196,7 +222,8 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => { vi.stubEnv("USE_DEV_SEED", "true"); vi.stubEnv("WEB_NEXT_SENTRY_DSN", "https://x@y/1"); const { bindAll } = await import("./bind-production"); - const { bindOtelInstrumentation } = await import("@repo/core-shared/instrumentation"); + const { bindOtelInstrumentation } = + await import("@repo/core-shared/instrumentation"); const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed"); await bindAll(); @@ -209,8 +236,10 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => { vi.stubEnv("WEB_NEXT_SENTRY_DSN", ""); vi.stubEnv("NODE_ENV", "production"); const { bindAll } = await import("./bind-production"); - const { bindNoopInstrumentation } = await import("@repo/core-shared/instrumentation"); - const { bindProductionBlog } = await import("@repo/blog/di/bind-production"); + const { bindNoopInstrumentation } = + await import("@repo/core-shared/instrumentation"); + const { bindProductionBlog } = + await import("@repo/blog/di/bind-production"); await bindAll(); diff --git a/docs/decisions/adr-013-input-output-unification.md b/docs/decisions/adr-013-input-output-unification.md index 9497ae6..0f06fb8 100644 --- a/docs/decisions/adr-013-input-output-unification.md +++ b/docs/decisions/adr-013-input-output-unification.md @@ -153,5 +153,4 @@ presenter>>`. Identity presenters are permitted and expected for ## References -- Reference repo: https://github.com/nikolovlazar/nextjs-clean-architecture - Prior ADRs: ADR-008 (per-feature DI), ADR-011 (TDD foundation), ADR-012 (feature conventions) diff --git a/packages/core-testing/src/setup/no-instrumentation.test.ts b/packages/core-testing/src/setup/no-instrumentation.test.ts index dad0cb1..a24ce15 100644 --- a/packages/core-testing/src/setup/no-instrumentation.test.ts +++ b/packages/core-testing/src/setup/no-instrumentation.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect, vi } from "vitest"; import * as Sentry from "@sentry/nextjs"; -describe("setup/no-instrumentation guard (R49)", () => { +describe("setup/no-instrumentation guard", () => { it("Sentry.init is a vi.fn (mocked, not real)", () => { expect(vi.isMockFunction(Sentry.init)).toBe(true); }); @@ -11,6 +11,10 @@ describe("setup/no-instrumentation guard (R49)", () => { }); it("calling Sentry.init does not throw or initialize", () => { - expect(() => Sentry.init({ dsn: "https://x@y/1" } as Parameters[0])).not.toThrow(); + expect(() => + Sentry.init({ dsn: "https://x@y/1" } as Parameters< + typeof Sentry.init + >[0]), + ).not.toThrow(); }); });