Implement testing framework with Vitest, add unit tests for API routes and utility functions, and configure CI workflow for automated testing. Update package dependencies for testing libraries and add test scripts to package.json.
Some checks are pending
CI / test (push) Waiting to run

This commit is contained in:
2025-12-22 12:50:35 -06:00
parent f92b73c7db
commit c7e7d63be5
16 changed files with 3110 additions and 35 deletions

22
lib/mime.ts Normal file
View File

@@ -0,0 +1,22 @@
import type { AudioFormat, VideoFormat, FormatType } from './types';
export const VIDEO_MIME: Record<VideoFormat, string> = {
mp4: 'video/mp4',
webm: 'video/webm',
mkv: 'video/x-matroska',
avi: 'video/x-msvideo',
};
export const AUDIO_MIME: Record<AudioFormat, string> = {
mp3: 'audio/mpeg',
wav: 'audio/wav',
m4a: 'audio/mp4',
opus: 'audio/ogg',
};
export function getMimeType(formatType: FormatType, format: VideoFormat | AudioFormat): string {
if (formatType === 'video') {
return VIDEO_MIME[format as VideoFormat] || 'application/octet-stream';
}
return AUDIO_MIME[format as AudioFormat] || 'application/octet-stream';
}