diff options
Diffstat (limited to 'apps/web/src/services/storage/migrations')
| -rw-r--r-- | apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts | 16 | ||||
| -rw-r--r-- | apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts | 24 |
2 files changed, 24 insertions, 16 deletions
diff --git a/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts b/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts index 31f7dae8..7a4dd641 100644 --- a/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts +++ b/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts @@ -1,10 +1,10 @@ import { describe, expect, test } from "bun:test"; import { - DEFAULT_BLUR_INTENSITY, - DEFAULT_CANVAS_SIZE, - DEFAULT_COLOR, - DEFAULT_FPS, -} from "@/constants/project-constants"; + DEFAULT_BACKGROUND_BLUR_INTENSITY, + DEFAULT_BACKGROUND_COLOR, +} from "@/lib/background/constants"; +import { DEFAULT_CANVAS_SIZE } from "@/lib/canvas/constants"; +import { DEFAULT_FPS } from "@/lib/fps/constants"; import type { MediaAssetData } from "@/services/storage/types"; import { getProjectId, transformProjectV1ToV2 } from "../transformers/v1-to-v2"; import { @@ -119,7 +119,7 @@ describe("V1 to V2 Migration", () => { const background = settings.background as Record<string, unknown>; expect(background.type).toBe("color"); - expect(background.color).toBe(DEFAULT_COLOR); + expect(background.color).toBe(DEFAULT_BACKGROUND_COLOR); }); test("uses default blur intensity when missing", async () => { @@ -135,7 +135,9 @@ describe("V1 to V2 Migration", () => { const settings = result.project.settings as Record<string, unknown>; const background = settings.background as Record<string, unknown>; - expect(background.blurIntensity).toBe(DEFAULT_BLUR_INTENSITY); + expect(background.blurIntensity).toBe( + DEFAULT_BACKGROUND_BLUR_INTENSITY, + ); }); test("preserves currentSceneId", async () => { diff --git a/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts b/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts index 52701cd5..a2c72478 100644 --- a/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts +++ b/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts @@ -1,9 +1,9 @@ import { - DEFAULT_BLUR_INTENSITY, - DEFAULT_CANVAS_SIZE, - DEFAULT_COLOR, - DEFAULT_FPS, -} from "@/constants/project-constants"; + DEFAULT_BACKGROUND_BLUR_INTENSITY, + DEFAULT_BACKGROUND_COLOR, +} from "@/lib/background/constants"; +import { DEFAULT_CANVAS_SIZE } from "@/lib/canvas/constants"; +import { DEFAULT_FPS } from "@/lib/fps/constants"; import { IndexedDBAdapter } from "@/services/storage/indexeddb-adapter"; import type { MediaAssetData } from "@/services/storage/types"; import type { MigrationResult, ProjectRecord } from "./types"; @@ -739,14 +739,17 @@ function getBackgroundValue({ type: "blur", blurIntensity: getNumberValue({ value: value.blurIntensity, - fallback: DEFAULT_BLUR_INTENSITY, + fallback: DEFAULT_BACKGROUND_BLUR_INTENSITY, }), }; } return { type: "color", - color: getStringValue({ value: value.color, fallback: DEFAULT_COLOR }), + color: getStringValue({ + value: value.color, + fallback: DEFAULT_BACKGROUND_COLOR, + }), }; } @@ -755,14 +758,17 @@ function getBackgroundValue({ type: "blur", blurIntensity: getNumberValue({ value: blurIntensity, - fallback: DEFAULT_BLUR_INTENSITY, + fallback: DEFAULT_BACKGROUND_BLUR_INTENSITY, }), }; } return { type: "color", - color: getStringValue({ value: backgroundColor, fallback: DEFAULT_COLOR }), + color: getStringValue({ + value: backgroundColor, + fallback: DEFAULT_BACKGROUND_COLOR, + }), }; } |
