feat(canvas): 画布工作台 - 新增生成副本并修复大型画布性能、素材同步与删除校验
统一图片与视频副本的生成落点并保留参考连接。\n优化大型画布节点虚拟化、媒体懒加载、拖拽与详情进入路径。\n修复素材主版本 ID 同步及删除时的画布独立引用校验。
This commit is contained in:
1 parent
434f63e153
commit
3f4a9ea3d0
45 files changed
+1348
-286
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { assetForRemoteSync } from "@/lib/asset-remote-sync";
|
||||
import type { Asset } from "@/stores/use-asset-store";
|
||||
|
||||
function imageAsset(primaryVersionId?: string): Asset {
|
||||
return {
|
||||
id: "asset-1",
|
||||
kind: "image",
|
||||
title: "测试素材",
|
||||
coverUrl: "opaque://asset",
|
||||
tags: [],
|
||||
primaryVersionId,
|
||||
createdAt: "2026-09-01T00:00:00.000Z",
|
||||
updatedAt: "2026-09-01T00:00:00.000Z",
|
||||
data: { dataUrl: "opaque://asset", width: 1, height: 1, bytes: 1, mimeType: "image/png" },
|
||||
};
|
||||
}
|
||||
|
||||
describe("asset remote sync", () => {
|
||||
test("removes an invalid historical primary version id only from the remote payload", () => {
|
||||
const source = imageAsset("generation-result:" + "x".repeat(40));
|
||||
|
||||
const remote = assetForRemoteSync(source);
|
||||
|
||||
expect(remote.primaryVersionId).toBeUndefined();
|
||||
expect(source.primaryVersionId).toBe("generation-result:" + "x".repeat(40));
|
||||
expect(remote).not.toBe(source);
|
||||
});
|
||||
|
||||
test("preserves a valid backend version uuid", () => {
|
||||
const source = imageAsset("123e4567-e89b-12d3-a456-426614174000");
|
||||
|
||||
expect(assetForRemoteSync(source)).toBe(source);
|
||||
expect(source.primaryVersionId).toBe("123e4567-e89b-12d3-a456-426614174000");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user