Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

test(editor): expand auto clip guard coverage

wiiiii1238e2a69574dc0
diff --git a/src/components/video-editor/types.test.ts b/src/components/video-editor/types.test.ts
index e7054d61..1d4412f1 100644
--- a/src/components/video-editor/types.test.ts
+++ b/src/components/video-editor/types.test.ts
@@ -25,7 +25,7 @@ describe("extendAutoFullTrackClip", () => {
).toBeNull();
});
- it("does not change multi-clip timelines or non-growing durations", () => {
+ it("does not change multi-clip timelines", () => {
expect(
extendAutoFullTrackClip(
[
@@ -37,6 +37,9 @@ describe("extendAutoFullTrackClip", () => {
10_000,
),
).toBeNull();
+ });
+
+ it("does not change clips when the duration does not grow", () => {
expect(
extendAutoFullTrackClip(
[{ id: "clip-1", startMs: 0, endMs: 8_000, speed: 1 }],
@@ -46,4 +49,59 @@ describe("extendAutoFullTrackClip", () => {
),
).toBeNull();
});
+
+ it("does not change clips when the auto-created clip id is missing", () => {
+ expect(
+ extendAutoFullTrackClip(
+ [{ id: "clip-1", startMs: 0, endMs: 5_000, speed: 1 }],
+ null,
+ 5_000,
+ 8_000,
+ ),
+ ).toBeNull();
+ });
+
+ it("does not change clips when the previous auto-created end time is missing", () => {
+ expect(
+ extendAutoFullTrackClip(
+ [{ id: "clip-1", startMs: 0, endMs: 5_000, speed: 1 }],
+ "clip-1",
+ null,
+ 8_000,
+ ),
+ ).toBeNull();
+ });
+
+ it("does not change clips when the reported duration shrinks", () => {
+ expect(
+ extendAutoFullTrackClip(
+ [{ id: "clip-1", startMs: 0, endMs: 8_000, speed: 1 }],
+ "clip-1",
+ 8_000,
+ 7_000,
+ ),
+ ).toBeNull();
+ });
+
+ it("does not change clips when the tracked clip id no longer matches", () => {
+ expect(
+ extendAutoFullTrackClip(
+ [{ id: "clip-1", startMs: 0, endMs: 5_000, speed: 1 }],
+ "clip-2",
+ 5_000,
+ 8_000,
+ ),
+ ).toBeNull();
+ });
+
+ it("does not change clips when the clip no longer starts at zero", () => {
+ expect(
+ extendAutoFullTrackClip(
+ [{ id: "clip-1", startMs: 250, endMs: 5_000, speed: 1 }],
+ "clip-1",
+ 5_000,
+ 8_000,
+ ),
+ ).toBeNull();
+ });
});