refactor: 拆分品牌业务类型与页面方案
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
This commit is contained in:
1 parent
f02e2cafbb
commit
0d9f4a7d6f
86 files changed
+4111
-1543
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { compareTemplateVersions, latestTemplateVersion } from "../src/template-version-order.js";
|
||||
|
||||
test("模板版本按 SemVer 而不是导入时间判断最新版", () => {
|
||||
const importedLaterOldVersion = {
|
||||
version: "1.9.0",
|
||||
importedAt: new Date("2026-10-20T00:00:00Z"),
|
||||
};
|
||||
const importedEarlierNewVersion = {
|
||||
version: "1.10.0",
|
||||
importedAt: new Date("2026-10-19T00:00:00Z"),
|
||||
};
|
||||
assert.equal(
|
||||
latestTemplateVersion([importedEarlierNewVersion, importedLaterOldVersion])?.version,
|
||||
"1.10.0",
|
||||
);
|
||||
assert.ok(compareTemplateVersions("1.10.0", "1.9.0") > 0);
|
||||
});
|
||||
|
||||
test("模板版本排序正确处理预发布版本和同版本稳定性", () => {
|
||||
assert.ok(compareTemplateVersions("1.0.0", "1.0.0-beta.2") > 0);
|
||||
assert.ok(compareTemplateVersions("1.0.0-beta.10", "1.0.0-beta.2") > 0);
|
||||
const first = {
|
||||
version: "1.0.0",
|
||||
importedAt: new Date("2026-10-19T00:00:00Z"),
|
||||
};
|
||||
const second = {
|
||||
version: "1.0.0",
|
||||
importedAt: new Date("2026-10-20T00:00:00Z"),
|
||||
};
|
||||
assert.equal(latestTemplateVersion([first, second]), second);
|
||||
});
|
||||
Reference in new issue
Block a user