more test stuff

This commit is contained in:
Maze Winther
2026-02-01 13:31:44 +01:00
parent 3e4584edde
commit dfccf905bb
2 changed files with 37 additions and 0 deletions
@@ -119,3 +119,29 @@ export const v2ProjectEmptyScenes = {
currentSceneId: "", currentSceneId: "",
scenes: [], scenes: [],
}; };
export const v2ProjectSceneWithoutTracks = {
id: "project-v2-no-tracks",
version: 2,
metadata: {
id: "project-v2-no-tracks",
name: "Scene Without Tracks",
createdAt: "2024-04-01T00:00:00.000Z",
updatedAt: "2024-04-01T00:00:00.000Z",
},
settings: {
fps: 30,
canvasSize: { width: 1920, height: 1080 },
background: { type: "color", color: "#000000" },
},
currentSceneId: "scene-1",
scenes: [
{
id: "scene-1",
name: "Main Scene",
isMain: true,
createdAt: "2024-04-01T00:00:00.000Z",
updatedAt: "2024-04-01T00:00:00.000Z",
},
],
};
@@ -4,6 +4,7 @@ import {
projectWithNoId, projectWithNoId,
v2Project, v2Project,
v2ProjectEmptyScenes, v2ProjectEmptyScenes,
v2ProjectSceneWithoutTracks,
v2ProjectWithBlurBackground, v2ProjectWithBlurBackground,
v3Project, v3Project,
} from "./fixtures"; } from "./fixtures";
@@ -48,6 +49,16 @@ describe("V2 to V3 Migration", () => {
expect(metadata.duration).toBe(0); expect(metadata.duration).toBe(0);
}); });
test("handles scene without tracks property", () => {
const result = transformProjectV2ToV3({
project: v2ProjectSceneWithoutTracks,
});
expect(result.skipped).toBe(false);
const metadata = result.project.metadata as Record<string, unknown>;
expect(metadata.duration).toBe(0);
});
test("skips project that already has v3 structure", () => { test("skips project that already has v3 structure", () => {
const result = transformProjectV2ToV3({ project: v3Project }); const result = transformProjectV2ToV3({ project: v3Project });