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 /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"), }); }); });