fix(test): align media path mocks and deploy contract with main
CI / check (push) Successful in 23s
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m22s
CI / deploy (push) Failing after 11s

Use path.join in admin-media tests for Windows path.sep checks, and drop the deploy-job pnpm test expectation after it moved to CI.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-30 19:41:45 +02:00
1 parent 6eab5e5343
commit ed5b9a6f7c
2 files changed
+12 -8

No files matched your search

+9 -4
View File
@@ -1,5 +1,7 @@
// @ts-nocheck
import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { revalidatePath } from "next/cache";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { requirePermission } from "@/lib/admin/guard";
@@ -9,10 +11,13 @@ import { deleteMedia, uploadMedia, uploadMediaAndReturn } from "./admin-media";
vi.mock("@/lib/admin/guard", () => ({ requirePermission: vi.fn() }));
vi.mock("@/lib/permissions", () => ({ PERMS: { PAGES_EDIT: "pages.edit" } }));
vi.mock("@/lib/media-storage", () => ({
MEDIA_ROOT: "/tmp/nexst-test-media",
resolveMediaPath: vi.fn((name: string) => `/tmp/nexst-test-media/${name}`),
}));
vi.mock("@/lib/media-storage", () => {
const root = path.join("/tmp", "nexst-test-media");
return {
MEDIA_ROOT: root,
resolveMediaPath: vi.fn((name: string) => path.join(root, name)),
};
});
vi.mock("node:fs/promises", () => ({
mkdir: vi.fn(),
writeFile: vi.fn(),
+3 -4
View File
@@ -83,13 +83,12 @@ describe("production deploy workflow", () => {
expect(workflow).not.toContain("PNPM_CONFIG_ONLY_BUILT_DEPENDENCIES");
});
it("runs typecheck and tests before build in the stage", () => {
it("runs typecheck before build in the stage", () => {
const typecheckAt = deployJob.indexOf("pnpm typecheck");
const testAt = deployJob.indexOf("pnpm test");
const buildAt = deployJob.indexOf("pnpm build");
expect(typecheckAt).toBeGreaterThan(-1);
expect(testAt).toBeGreaterThan(typecheckAt);
expect(buildAt).toBeGreaterThan(testAt);
expect(buildAt).toBeGreaterThan(typecheckAt);
expect(deployJob).not.toContain("pnpm test");
});
it("exports APP_VERSION from git for Sentry releases", () => {