summaryrefslogtreecommitdiff
path: root/apps/web/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src')
-rw-r--r--apps/web/src/services/storage/migrations/__tests__/fixtures/v2.ts26
-rw-r--r--apps/web/src/services/storage/migrations/__tests__/v2-to-v3.test.ts11
2 files changed, 37 insertions, 0 deletions
diff --git a/apps/web/src/services/storage/migrations/__tests__/fixtures/v2.ts b/apps/web/src/services/storage/migrations/__tests__/fixtures/v2.ts
index 58813a9e..85ea69f5 100644
--- a/apps/web/src/services/storage/migrations/__tests__/fixtures/v2.ts
+++ b/apps/web/src/services/storage/migrations/__tests__/fixtures/v2.ts
@@ -119,3 +119,29 @@ export const v2ProjectEmptyScenes = {
currentSceneId: "",
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",
+ },
+ ],
+};
diff --git a/apps/web/src/services/storage/migrations/__tests__/v2-to-v3.test.ts b/apps/web/src/services/storage/migrations/__tests__/v2-to-v3.test.ts
index 6e2991d0..ba8b3bfb 100644
--- a/apps/web/src/services/storage/migrations/__tests__/v2-to-v3.test.ts
+++ b/apps/web/src/services/storage/migrations/__tests__/v2-to-v3.test.ts
@@ -4,6 +4,7 @@ import {
projectWithNoId,
v2Project,
v2ProjectEmptyScenes,
+ v2ProjectSceneWithoutTracks,
v2ProjectWithBlurBackground,
v3Project,
} from "./fixtures";
@@ -48,6 +49,16 @@ describe("V2 to V3 Migration", () => {
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", () => {
const result = transformProjectV2ToV3({ project: v3Project });