1
0
Fork 0
polaris-task-force/tests/int/voiceover-config.int.spec.ts
Z8MB1E 8e42077c1f fix(uploads): store upload collections under the persistent media volume
VoiceSubmissions, ModLists and MissionFiles relied on Payload's default
upload staticDir (the collection slug resolved from cwd), so prod wrote
their files to /app/<slug> instead of the mounted /app/media volume and
every redeploy wiped them (voice takes returned 500 on play/download).
Pin all three under media/ subdirs like story Voiceovers already does,
add regression guards, and fix the audio-preview fallbacks that pointed
at the media collection's file route instead of the owning collection.
2026-10-08 12:14:46 -04:00

26 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import path from "path";
import { VoiceSubmissions } from "@/collections/voiceover/VoiceSubmissions";
describe("VoiceSubmissions upload config", () => {
// Regression guard: Payload content-sniffs uploads (file-type) and reports
// browser-recorded WebM takes as `video/webm`, so a MIME allowlist rejects
// every in-browser recording. The collection must accept any audio format;
// the submit server action is the audio/* gate instead.
it("accepts any standard audio format (no MIME allowlist)", () => {
expect(VoiceSubmissions.upload).toBeDefined();
expect(VoiceSubmissions.upload).not.toHaveProperty("mimeTypes");
});
// Regression guard: Payload defaults an upload collection's staticDir to its
// slug resolved from cwd (dist/collections/config/sanitize.js). Without an
// explicit override, takes are written to <cwd>/voice-submissions, which is
// NOT the persistent /app/media volume in production — every redeploy wipes
// them and playback/download 404s (2026-10 prod incident).
it("stores files under the persistent media volume (explicit staticDir)", () => {
expect(VoiceSubmissions.upload).toMatchObject({
staticDir: path.resolve(process.cwd(), "media", "voice-submissions"),
});
});
});