调试通过

This commit is contained in:
cheney 2026-06-17 10:25:27 +08:00
parent 364efbc1c1
commit a7f596aa0a
3 changed files with 13 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules node_modules
dist dist
build.json build.json
kit/.kit/modules/*

View File

@ -1,2 +1,3 @@
- 每个函数都要有中文注释, 包括功能说明、参数说明、返回值说明等,如果有注意事项,也要在注释中特别说明。
- 每次需求修改都要同时更新文档、代码、测试代码。 - 每次需求修改都要同时更新文档、代码、测试代码。
- 每条测试用例都要有一个唯一编号。例如 1-1、2-20 等。 - 每条测试用例都要有一个唯一编号。例如 1-1、2-20 等。

View File

@ -117,7 +117,7 @@ function trackRemote(group, projectId) {
} }
manualDescribe("remote module public API manual webdav", () => { manualDescribe("remote module public API manual webdav", () => {
manualTest("exposes documented public methods", async () => { manualTest("1-1 exposes documented public methods", async () => {
expect(typeof remote.check).toBe("function"); expect(typeof remote.check).toBe("function");
expect(typeof remote.publish).toBe("function"); expect(typeof remote.publish).toBe("function");
expect(typeof remote.install).toBe("function"); expect(typeof remote.install).toBe("function");
@ -127,11 +127,11 @@ manualDescribe("remote module public API manual webdav", () => {
expect(typeof remote.remove).toBe("function"); expect(typeof remote.remove).toBe("function");
}); });
manualTest("check validates an available webdav client", async () => { manualTest("1-2 check validates an available webdav client", async () => {
expect(await remote.check()).toBe(true); expect(await remote.check()).toBe(true);
}); });
manualTest("publish stores files under default group /modules/id", async () => { manualTest("1-3 publish stores files under default group /modules/id", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
trackRemote("/modules", projectId); trackRemote("/modules", projectId);
const projectDir = writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId }); const projectDir = writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId });
@ -151,7 +151,7 @@ manualDescribe("remote module public API manual webdav", () => {
expect(artifact).toBe("hello v1"); expect(artifact).toBe("hello v1");
}, 30000); }, 30000);
manualTest("publish supports custom nested group", async () => { manualTest("1-4 publish supports custom nested group", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
const group = `/kit-manual-test/${runId}/docker/net`; const group = `/kit-manual-test/${runId}/docker/net`;
trackRemote(group, projectId); trackRemote(group, projectId);
@ -165,7 +165,7 @@ manualDescribe("remote module public API manual webdav", () => {
expect(artifact).toBe("docker net"); expect(artifact).toBe("docker net");
}, 30000); }, 30000);
manualTest("empty group stores project at repository root", async () => { manualTest("1-5 empty group stores project at repository root", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
trackRemote("", projectId); trackRemote("", projectId);
await remote.publish(writeFixtureProject(tempDir, "1.0", "root group", { id: projectId, group: "" })); await remote.publish(writeFixtureProject(tempDir, "1.0", "root group", { id: projectId, group: "" }));
@ -175,7 +175,7 @@ manualDescribe("remote module public API manual webdav", () => {
expect(await remote.client.getFileContents(`/${projectId}/1.0/any/any/myapp.txt`, { format: "text" })).toBe("root group"); expect(await remote.client.getFileContents(`/${projectId}/1.0/any/any/myapp.txt`, { format: "text" })).toBe("root group");
}, 30000); }, 30000);
manualTest("explicit version fails when remote version already exists", async () => { manualTest("1-6 explicit version fails when remote version already exists", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
trackRemote("/modules", projectId); trackRemote("/modules", projectId);
await remote.publish(writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId })); await remote.publish(writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId }));
@ -183,7 +183,7 @@ manualDescribe("remote module public API manual webdav", () => {
await expect(remote.publish(writeFixtureProject(tempDir, "1.0", "hello again", { id: projectId }))).rejects.toThrow("远程版本已存在"); await expect(remote.publish(writeFixtureProject(tempDir, "1.0", "hello again", { id: projectId }))).rejects.toThrow("远程版本已存在");
}, 30000); }, 30000);
manualTest("blank version increments remote version tail or starts at 1.0", async () => { manualTest("1-7 blank version increments remote version tail or starts at 1.0", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
trackRemote("/modules", projectId); trackRemote("/modules", projectId);
@ -197,7 +197,7 @@ manualDescribe("remote module public API manual webdav", () => {
expect(await remote.client.getFileContents(`/modules/${projectId}/1.1/any/any/myapp.txt`, { format: "text" })).toBe("second auto"); expect(await remote.client.getFileContents(`/modules/${projectId}/1.1/any/any/myapp.txt`, { format: "text" })).toBe("second auto");
}, 30000); }, 30000);
manualTest("install downloads latest version from default group", async () => { manualTest("1-8 install downloads latest version from default group", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
trackRemote("/modules", projectId); trackRemote("/modules", projectId);
await remote.publish(writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId })); await remote.publish(writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId }));
@ -215,7 +215,7 @@ manualDescribe("remote module public API manual webdav", () => {
expect(fs.existsSync(path.resolve(moduleRoot, "current"))).toBe(true); expect(fs.existsSync(path.resolve(moduleRoot, "current"))).toBe(true);
}, 30000); }, 30000);
manualTest("install can target a custom group path", async () => { manualTest("1-9 install can target a custom group path", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
const group = `/kit-manual-test/${runId}/docker/net`; const group = `/kit-manual-test/${runId}/docker/net`;
trackRemote(group, projectId); trackRemote(group, projectId);
@ -228,7 +228,7 @@ manualDescribe("remote module public API manual webdav", () => {
expect(installedFile).toBe("docker install"); expect(installedFile).toBe("docker install");
}, 30000); }, 30000);
manualTest("list use rollback and remove manage installed versions", async () => { manualTest("1-10 list use rollback and remove manage installed versions", async () => {
const projectId = nextProjectId(); const projectId = nextProjectId();
trackRemote("/modules", projectId); trackRemote("/modules", projectId);
await remote.publish(writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId })); await remote.publish(writeFixtureProject(tempDir, "1.0", "hello v1", { id: projectId }));