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";
|
||||
|
||||
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<typeof import("@repo/core-shared/instrumentation")>();
|
||||
const actual =
|
||||
await importOriginal<typeof import("@repo/core-shared/instrumentation")>();
|
||||
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user