refactor: strip residual R-number test descriptions + Lazar URL from ADR-013
This commit is contained in:
@@ -1,19 +1,36 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||||
|
|
||||||
vi.mock("@repo/core-cms", () => ({ default: Promise.resolve({}) }));
|
vi.mock("@repo/core-cms", () => ({ default: Promise.resolve({}) }));
|
||||||
vi.mock("payload", () => ({ getPayload: vi.fn(async () => ({ jobs: { queue: vi.fn() } })) }));
|
vi.mock("payload", () => ({
|
||||||
vi.mock("@repo/blog/di/bind-production", () => ({ bindProductionBlog: vi.fn() }));
|
getPayload: vi.fn(async () => ({ jobs: { queue: 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/blog/di/bind-production", () => ({
|
||||||
vi.mock("@repo/navigation/di/bind-production", () => ({ bindProductionNavigation: vi.fn() }));
|
bindProductionBlog: vi.fn(),
|
||||||
vi.mock("@repo/media/di/bind-production", () => ({ bindProductionMedia: 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/blog/di/bind-dev-seed", () => ({ bindDevSeedBlog: vi.fn() }));
|
||||||
vi.mock("@repo/auth/di/bind-dev-seed", () => ({ bindDevSeedAuth: 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/marketing-pages/di/bind-dev-seed", () => ({
|
||||||
vi.mock("@repo/navigation/di/bind-dev-seed", () => ({ bindDevSeedNavigation: vi.fn() }));
|
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/media/di/bind-dev-seed", () => ({ bindDevSeedMedia: vi.fn() }));
|
||||||
vi.mock("@repo/core-shared/instrumentation", async (importOriginal) => {
|
vi.mock("@repo/core-shared/instrumentation", async (importOriginal) => {
|
||||||
const actual = await importOriginal<typeof import("@repo/core-shared/instrumentation")>();
|
const actual =
|
||||||
|
await importOriginal<typeof import("@repo/core-shared/instrumentation")>();
|
||||||
const mockedOtel = vi.fn(actual.bindOtelInstrumentation);
|
const mockedOtel = vi.fn(actual.bindOtelInstrumentation);
|
||||||
return {
|
return {
|
||||||
...actual,
|
...actual,
|
||||||
@@ -32,11 +49,16 @@ describe("bindAllProduction", () => {
|
|||||||
|
|
||||||
it("binds all five feature production repos", async () => {
|
it("binds all five feature production repos", async () => {
|
||||||
const { bindAllProduction } = await import("./bind-production");
|
const { bindAllProduction } = await import("./bind-production");
|
||||||
const { bindProductionBlog } = await import("@repo/blog/di/bind-production");
|
const { bindProductionBlog } =
|
||||||
const { bindProductionAuth } = await import("@repo/auth/di/bind-production");
|
await import("@repo/blog/di/bind-production");
|
||||||
const { bindProductionMarketingPages } = await import("@repo/marketing-pages/di/bind-production");
|
const { bindProductionAuth } =
|
||||||
const { bindProductionNavigation } = await import("@repo/navigation/di/bind-production");
|
await import("@repo/auth/di/bind-production");
|
||||||
const { bindProductionMedia } = await import("@repo/media/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();
|
await bindAllProduction();
|
||||||
|
|
||||||
@@ -49,7 +71,8 @@ describe("bindAllProduction", () => {
|
|||||||
|
|
||||||
it("is idempotent — second call does not re-bind", async () => {
|
it("is idempotent — second call does not re-bind", async () => {
|
||||||
const { bindAllProduction } = await import("./bind-production");
|
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();
|
||||||
await bindAllProduction();
|
await bindAllProduction();
|
||||||
expect(bindProductionBlog).toHaveBeenCalledOnce();
|
expect(bindProductionBlog).toHaveBeenCalledOnce();
|
||||||
@@ -57,7 +80,8 @@ describe("bindAllProduction", () => {
|
|||||||
|
|
||||||
it("passes a Payload-backed queue to each per-feature binder", async () => {
|
it("passes a Payload-backed queue to each per-feature binder", async () => {
|
||||||
const { bindAllProduction } = await import("./bind-production");
|
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");
|
const { PayloadJobQueue } = await import("@repo/core-shared/jobs");
|
||||||
|
|
||||||
await bindAllProduction();
|
await bindAllProduction();
|
||||||
@@ -103,7 +127,8 @@ describe("bindAll dispatcher", () => {
|
|||||||
vi.stubEnv("NODE_ENV", "production"); // even in production, dev seed wins
|
vi.stubEnv("NODE_ENV", "production"); // even in production, dev seed wins
|
||||||
const { bindAll } = await import("./bind-production");
|
const { bindAll } = await import("./bind-production");
|
||||||
const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed");
|
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();
|
await bindAll();
|
||||||
|
|
||||||
@@ -114,7 +139,8 @@ describe("bindAll dispatcher", () => {
|
|||||||
it("NODE_ENV='production' (no override) → dispatches to bindAllProduction", async () => {
|
it("NODE_ENV='production' (no override) → dispatches to bindAllProduction", async () => {
|
||||||
vi.stubEnv("NODE_ENV", "production");
|
vi.stubEnv("NODE_ENV", "production");
|
||||||
const { bindAll } = await import("./bind-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");
|
const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed");
|
||||||
|
|
||||||
await bindAll();
|
await bindAll();
|
||||||
@@ -127,7 +153,8 @@ describe("bindAll dispatcher", () => {
|
|||||||
vi.stubEnv("NODE_ENV", "development");
|
vi.stubEnv("NODE_ENV", "development");
|
||||||
const { bindAll } = await import("./bind-production");
|
const { bindAll } = await import("./bind-production");
|
||||||
const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed");
|
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();
|
await bindAll();
|
||||||
|
|
||||||
@@ -139,7 +166,8 @@ describe("bindAll dispatcher", () => {
|
|||||||
vi.stubEnv("USE_DEV_SEED", "false");
|
vi.stubEnv("USE_DEV_SEED", "false");
|
||||||
vi.stubEnv("NODE_ENV", "production");
|
vi.stubEnv("NODE_ENV", "production");
|
||||||
const { bindAll } = await import("./bind-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");
|
const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed");
|
||||||
|
|
||||||
await bindAll();
|
await bindAll();
|
||||||
@@ -164,13 +192,12 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => {
|
|||||||
// to the same spy as bindOtelInstrumentation. Assertions against either name
|
// to the same spy as bindOtelInstrumentation. Assertions against either name
|
||||||
// verify the same call, which also validates the deprecation alias is wired.
|
// 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("WEB_NEXT_SENTRY_DSN", "");
|
||||||
vi.stubEnv("NODE_ENV", "production");
|
vi.stubEnv("NODE_ENV", "production");
|
||||||
const { bindAll } = await import("./bind-production");
|
const { bindAll } = await import("./bind-production");
|
||||||
const { bindNoopInstrumentation, bindOtelInstrumentation } = await import(
|
const { bindNoopInstrumentation, bindOtelInstrumentation } =
|
||||||
"@repo/core-shared/instrumentation"
|
await import("@repo/core-shared/instrumentation");
|
||||||
);
|
|
||||||
|
|
||||||
await bindAll();
|
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("WEB_NEXT_SENTRY_DSN", "https://x@y/1");
|
||||||
vi.stubEnv("NODE_ENV", "development");
|
vi.stubEnv("NODE_ENV", "development");
|
||||||
const { bindAll } = await import("./bind-production");
|
const { bindAll } = await import("./bind-production");
|
||||||
const { bindNoopInstrumentation, bindOtelInstrumentation } = await import(
|
const { bindNoopInstrumentation, bindOtelInstrumentation } =
|
||||||
"@repo/core-shared/instrumentation"
|
await import("@repo/core-shared/instrumentation");
|
||||||
);
|
|
||||||
|
|
||||||
await bindAll();
|
await bindAll();
|
||||||
|
|
||||||
@@ -196,7 +222,8 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => {
|
|||||||
vi.stubEnv("USE_DEV_SEED", "true");
|
vi.stubEnv("USE_DEV_SEED", "true");
|
||||||
vi.stubEnv("WEB_NEXT_SENTRY_DSN", "https://x@y/1");
|
vi.stubEnv("WEB_NEXT_SENTRY_DSN", "https://x@y/1");
|
||||||
const { bindAll } = await import("./bind-production");
|
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");
|
const { bindDevSeedBlog } = await import("@repo/blog/di/bind-dev-seed");
|
||||||
|
|
||||||
await bindAll();
|
await bindAll();
|
||||||
@@ -209,8 +236,10 @@ describe("bindAll instrumentation orthogonality (Rule 0, R47)", () => {
|
|||||||
vi.stubEnv("WEB_NEXT_SENTRY_DSN", "");
|
vi.stubEnv("WEB_NEXT_SENTRY_DSN", "");
|
||||||
vi.stubEnv("NODE_ENV", "production");
|
vi.stubEnv("NODE_ENV", "production");
|
||||||
const { bindAll } = await import("./bind-production");
|
const { bindAll } = await import("./bind-production");
|
||||||
const { bindNoopInstrumentation } = await import("@repo/core-shared/instrumentation");
|
const { bindNoopInstrumentation } =
|
||||||
const { bindProductionBlog } = await import("@repo/blog/di/bind-production");
|
await import("@repo/core-shared/instrumentation");
|
||||||
|
const { bindProductionBlog } =
|
||||||
|
await import("@repo/blog/di/bind-production");
|
||||||
|
|
||||||
await bindAll();
|
await bindAll();
|
||||||
|
|
||||||
|
|||||||
@@ -153,5 +153,4 @@ presenter>>`. Identity presenters are permitted and expected for
|
|||||||
|
|
||||||
## References
|
## 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)
|
- Prior ADRs: ADR-008 (per-feature DI), ADR-011 (TDD foundation), ADR-012 (feature conventions)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, it, expect, vi } from "vitest";
|
import { describe, it, expect, vi } from "vitest";
|
||||||
import * as Sentry from "@sentry/nextjs";
|
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)", () => {
|
it("Sentry.init is a vi.fn (mocked, not real)", () => {
|
||||||
expect(vi.isMockFunction(Sentry.init)).toBe(true);
|
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", () => {
|
it("calling Sentry.init does not throw or initialize", () => {
|
||||||
expect(() => Sentry.init({ dsn: "https://x@y/1" } as Parameters<typeof Sentry.init>[0])).not.toThrow();
|
expect(() =>
|
||||||
|
Sentry.init({ dsn: "https://x@y/1" } as Parameters<
|
||||||
|
typeof Sentry.init
|
||||||
|
>[0]),
|
||||||
|
).not.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user