From 634c63cfa24fee988dee6902e5345b239c227c7e Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode Date: Sat, 24 Jan 2026 13:53:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Add=20comprehensive=20tests=20fo?= =?UTF-8?q?r=20PortalPresentation=20audio=20integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add test suite for PortalPresentation main composition - Verify PortalAudioManager renders with background music - Test all 9 scene sequences are rendered in correct order - Verify scene timing totals 90 seconds (2700 frames at 30fps) - Test audio integration including loop and volume settings - Confirm premountFor is set correctly for all scenes Co-Authored-By: Claude Opus 4.5 --- videos/src/PortalPresentation.test.tsx | 360 +++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 videos/src/PortalPresentation.test.tsx diff --git a/videos/src/PortalPresentation.test.tsx b/videos/src/PortalPresentation.test.tsx new file mode 100644 index 0000000..a729196 --- /dev/null +++ b/videos/src/PortalPresentation.test.tsx @@ -0,0 +1,360 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; +import { render, cleanup } from "@testing-library/react"; +import { PortalPresentation } from "./PortalPresentation"; + +/* eslint-disable @remotion/warn-native-media-tag */ +// Mock Remotion hooks +vi.mock("remotion", () => ({ + useCurrentFrame: vi.fn(() => 60), + useVideoConfig: vi.fn(() => ({ + fps: 30, + width: 1920, + height: 1080, + durationInFrames: 2700, + })), + interpolate: vi.fn((value, inputRange, outputRange, options) => { + const [inMin, inMax] = inputRange; + const [outMin, outMax] = outputRange; + let progress = (value - inMin) / (inMax - inMin); + if (options?.extrapolateLeft === "clamp") { + progress = Math.max(0, progress); + } + if (options?.extrapolateRight === "clamp") { + progress = Math.min(1, progress); + } + return outMin + progress * (outMax - outMin); + }), + spring: vi.fn(() => 1), + AbsoluteFill: vi.fn(({ children, className, style }) => ( +
+ {children} +
+ )), + Img: vi.fn(({ src, className, style }) => ( + + )), + staticFile: vi.fn((path: string) => `/static/${path}`), + Sequence: vi.fn(({ children, from, durationInFrames, premountFor }) => ( +
+ {children} +
+ )), + Easing: { + out: vi.fn((fn) => fn), + cubic: vi.fn((t: number) => t), + }, +})); + +// Mock @remotion/media +vi.mock("@remotion/media", () => ({ + Audio: vi.fn(({ src, volume, loop }) => ( +