test(editor): expand auto clip guard coverage

This commit is contained in:
wiiiii123
2026-04-21 02:08:20 +07:00
parent a6653a5144
commit a62972239b
+59 -1
View File
@@ -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();
});
});