diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-29 18:41:15 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-05-02 03:27:23 +0200 |
| commit | 79dcec8a2ec2f5cad9be95e5b52fbfa752fb6ac4 (patch) | |
| tree | 99ff9393c4a550669ebac921c6a0535437a39413 /apps/web/src/services/storage/migrations/__tests__ | |
| parent | 97f8d1968f186028e41f83b04c0897130e6c69f4 (diff) | |
| download | opencut-79dcec8a2ec2f5cad9be95e5b52fbfa752fb6ac4.tar.gz | |
refactor: split builtin and freeform masks
Made-with: Cursor
Diffstat (limited to 'apps/web/src/services/storage/migrations/__tests__')
| -rw-r--r-- | apps/web/src/services/storage/migrations/__tests__/v30-to-v31.test.ts | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/apps/web/src/services/storage/migrations/__tests__/v30-to-v31.test.ts b/apps/web/src/services/storage/migrations/__tests__/v30-to-v31.test.ts new file mode 100644 index 00000000..e5c82ae2 --- /dev/null +++ b/apps/web/src/services/storage/migrations/__tests__/v30-to-v31.test.ts @@ -0,0 +1,57 @@ +import { describe, expect, test } from "bun:test"; +import { transformProjectV30ToV31 } from "../transformers/v30-to-v31"; +import { asRecord, asRecordArray } from "./helpers"; + +describe("V30 to V31 Migration", () => { + test("renames custom masks to freeform without changing params", () => { + const params = { + feather: 0, + inverted: false, + strokeColor: "#ffffff", + strokeWidth: 0, + strokeAlign: "center", + path: [{ id: "p1", x: 0, y: 0, inX: 0, inY: 0, outX: 0, outY: 0 }], + closed: true, + centerX: 0, + centerY: 0, + rotation: 0, + scale: 1, + }; + + const result = transformProjectV30ToV31({ + project: { + id: "project-v30-freeform", + version: 30, + scenes: [ + { + tracks: { + main: { + elements: [ + { + id: "image-1", + type: "image", + masks: [{ id: "mask-1", type: "custom", params }], + }, + ], + }, + }, + }, + ], + }, + }); + + expect(result.skipped).toBe(false); + expect(result.project.version).toBe(31); + const scene = asRecordArray(result.project.scenes)[0]; + const tracks = asRecord(scene.tracks); + const main = asRecord(tracks.main); + const element = asRecordArray(main.elements)[0]; + const mask = asRecordArray(asRecord(element).masks)[0]; + expect(mask).toMatchObject({ + id: "mask-1", + type: "freeform", + legacyType: "custom", + params, + }); + }); +}); |
