refactor(*): 稳定期治理 - 收敛核心架构、错误语义并修复跨项目数据竞态
This commit is contained in:
1 parent
83d9622fd0
commit
bf41ef3172
298 files changed
+12681
-26428
No files matched your search
@@ -2,10 +2,10 @@ import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
// @ts-expect-error -- Node 原生 TypeScript 测试运行器需要保留扩展名。
|
||||
import { normalizeAssetRecord } from "./asset-storage-revision.ts";
|
||||
import { parseAssetRecord } from "./asset-record.ts";
|
||||
|
||||
test("缺失图片尺寸的历史素材会补齐可渲染数据", () => {
|
||||
const asset = normalizeAssetRecord({
|
||||
test("缺失图片数据的历史素材会被拒绝,而不是补齐可渲染字段", () => {
|
||||
assert.throws(() => parseAssetRecord({
|
||||
id: "legacy-image",
|
||||
kind: "image",
|
||||
title: "历史图片",
|
||||
@@ -14,10 +14,5 @@ test("缺失图片尺寸的历史素材会补齐可渲染数据", () => {
|
||||
createdAt: "2026-01-01T00:00:00.000Z",
|
||||
updatedAt: "2026-01-01T00:00:00.000Z",
|
||||
data: undefined,
|
||||
} as never);
|
||||
|
||||
assert.equal(asset.kind, "image");
|
||||
assert.equal(asset.data.width, 0);
|
||||
assert.equal(asset.data.height, 0);
|
||||
assert.equal(asset.data.dataUrl, "https://example.com/image.png");
|
||||
}), /data/);
|
||||
});
|
||||
Reference in new issue
Block a user