mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-10-05 12:07:45 +00:00
* Fix embedded audio fallback handling and audio diagnostics * Add recording fallback diagnostics toasts * Fix Windows audio fallback cleanup and path matching * Format rebased recording fallback changes * Fix embedded audio preview and export fallback handling
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { resolveSourceAudioFallbackPaths } from "./sourceAudioFallback";
|
|
|
|
describe("resolveSourceAudioFallbackPaths", () => {
|
|
it("treats the video file path as embedded source audio when present in the fallback list", () => {
|
|
const videoPath = "/tmp/recording.mp4";
|
|
|
|
expect(
|
|
resolveSourceAudioFallbackPaths(videoPath, [videoPath, "/tmp/recording.mic.wav"]),
|
|
).toEqual({
|
|
hasEmbeddedSourceAudio: true,
|
|
externalAudioPaths: ["/tmp/recording.mic.wav"],
|
|
});
|
|
});
|
|
|
|
it("keeps all fallback paths external when the video has no embedded source audio", () => {
|
|
expect(
|
|
resolveSourceAudioFallbackPaths("/tmp/recording.mp4", [
|
|
"/tmp/recording.system.wav",
|
|
"/tmp/recording.mic.wav",
|
|
]),
|
|
).toEqual({
|
|
hasEmbeddedSourceAudio: false,
|
|
externalAudioPaths: ["/tmp/recording.system.wav", "/tmp/recording.mic.wav"],
|
|
});
|
|
});
|
|
|
|
it("matches embedded source audio when the video resource is a file URL", () => {
|
|
expect(
|
|
resolveSourceAudioFallbackPaths("file:///tmp/recording.mp4", [
|
|
"/tmp/recording.mp4",
|
|
"/tmp/recording.mic.wav",
|
|
]),
|
|
).toEqual({
|
|
hasEmbeddedSourceAudio: true,
|
|
externalAudioPaths: ["/tmp/recording.mic.wav"],
|
|
});
|
|
});
|
|
|
|
it("normalizes Windows file URLs and local paths when checking embedded audio", () => {
|
|
expect(
|
|
resolveSourceAudioFallbackPaths("file:///C:/Users/Egg/Videos/recording.mp4", [
|
|
"C:\\Users\\Egg\\Videos\\recording.mp4",
|
|
"C:\\Users\\Egg\\Videos\\recording.mic.wav",
|
|
]),
|
|
).toEqual({
|
|
hasEmbeddedSourceAudio: true,
|
|
externalAudioPaths: ["C:\\Users\\Egg\\Videos\\recording.mic.wav"],
|
|
});
|
|
});
|
|
|
|
it("matches Windows paths case-insensitively for embedded audio detection", () => {
|
|
expect(
|
|
resolveSourceAudioFallbackPaths("file:///C:/Users/Egg/Videos/recording.mp4", [
|
|
"c:\\users\\egg\\videos\\recording.mp4",
|
|
"c:\\users\\egg\\videos\\recording.mic.wav",
|
|
]),
|
|
).toEqual({
|
|
hasEmbeddedSourceAudio: true,
|
|
externalAudioPaths: ["c:\\users\\egg\\videos\\recording.mic.wav"],
|
|
});
|
|
});
|
|
});
|