summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/timeline/audio-separation/__tests__
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/lib/timeline/audio-separation/__tests__')
-rw-r--r--apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts55
1 files changed, 27 insertions, 28 deletions
diff --git a/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts b/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts
index 1946f1e0..f2b17d1a 100644
--- a/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts
+++ b/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test";
+import { upsertElementKeyframe } from "@/lib/animation";
import type { UploadAudioElement, VideoElement } from "@/lib/timeline";
import {
buildSeparatedAudioElement,
@@ -25,32 +26,7 @@ describe("audio separation", () => {
volume: -6,
muted: true,
retime: { rate: 1.25, maintainPitch: true },
- animations: {
- channels: {
- volume: {
- valueKind: "number",
- keyframes: [
- {
- id: "volume-keyframe",
- time: 2,
- value: -12,
- interpolation: "linear",
- },
- ],
- },
- opacity: {
- valueKind: "number",
- keyframes: [
- {
- id: "opacity-keyframe",
- time: 1,
- value: 0.5,
- interpolation: "linear",
- },
- ],
- },
- },
- },
+ animations: buildAnimations(),
});
const separatedAudioElement = buildSeparatedAudioElement({
@@ -71,11 +47,14 @@ describe("audio separation", () => {
muted: true,
retime: { rate: 1.25, maintainPitch: true },
});
- expect(Object.keys(separatedAudioElement.animations?.channels ?? {})).toEqual([
+ expect(Object.keys(separatedAudioElement.animations?.bindings ?? {})).toEqual([
"volume",
]);
+ expect(Object.keys(separatedAudioElement.animations?.channels ?? {})).toEqual([
+ "volume:value",
+ ]);
expect(
- separatedAudioElement.animations?.channels.volume?.keyframes[0]?.id,
+ separatedAudioElement.animations?.channels["volume:value"]?.keys[0]?.id,
).not.toBe("volume-keyframe");
});
@@ -143,3 +122,23 @@ function buildAudioElement(
...overrides,
} satisfies UploadAudioElement;
}
+
+function buildAnimations() {
+ const withVolume = upsertElementKeyframe({
+ animations: undefined,
+ propertyPath: "volume",
+ time: 2,
+ value: -12,
+ interpolation: "linear",
+ keyframeId: "volume-keyframe",
+ });
+
+ return upsertElementKeyframe({
+ animations: withVolume,
+ propertyPath: "opacity",
+ time: 1,
+ value: 0.5,
+ interpolation: "linear",
+ keyframeId: "opacity-keyframe",
+ });
+}