This commit is contained in:
+8
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { amountToCents, centsToAmount, exportRequestSchema } from "../shared/contracts.js";
|
||||
import { amountToCents, centsToAmount, exportRequestSchema, updateApplySchema } from "../shared/contracts.js";
|
||||
import { zonedMonthBounds } from "../server/app.js";
|
||||
import { safeExcelText } from "../server/exporter.js";
|
||||
import { safeStoragePath, sanitizeOriginalName } from "../server/files.js";
|
||||
@@ -30,6 +30,13 @@ describe("导出选项", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("更新版本", () => {
|
||||
it("接受合法的 prerelease 和 build metadata", () => {
|
||||
expect(updateApplySchema.parse({ version: "1.2.3+build.5", confirm: true }).version).toBe("1.2.3+build.5");
|
||||
expect(updateApplySchema.parse({ version: "v1.2.3-alpha.1+build.5", confirm: true }).version).toBe("v1.2.3-alpha.1+build.5");
|
||||
});
|
||||
});
|
||||
|
||||
describe("文件和导出安全", () => {
|
||||
it("不让用户文件名参与路径", () => {
|
||||
expect(sanitizeOriginalName("../../秘密\u0000.png")).toBe("秘密.png");
|
||||
|
||||
Reference in New Issue
Block a user