feat: 版本管理,package.json 唯一版本源、/api/meta 返回版本、Dashboard Header 展示版本号
This commit is contained in:
@@ -175,6 +175,7 @@ describe("API 路由", () => {
|
||||
config: { host: "127.0.0.1", port: 0 },
|
||||
mode: "test",
|
||||
store,
|
||||
version: "0.1.0",
|
||||
});
|
||||
baseUrl = `http://127.0.0.1:${server.port}`;
|
||||
});
|
||||
@@ -235,7 +236,7 @@ describe("API 路由", () => {
|
||||
expect(invalidLimit.status).toBe(400);
|
||||
});
|
||||
|
||||
test("/api/meta 返回 checker 类型列表", async () => {
|
||||
test("/api/meta 返回 checker 类型列表和版本号", async () => {
|
||||
const response = await fetch(`${baseUrl}/api/meta`);
|
||||
const body = (await response.json()) as MetaResponse;
|
||||
|
||||
@@ -243,6 +244,7 @@ describe("API 路由", () => {
|
||||
expect(body.checkerTypes).toEqual(checkerRegistry.supportedTypes);
|
||||
expect(body.checkerTypes).toContain("http");
|
||||
expect(body.checkerTypes).toContain("cmd");
|
||||
expect(body.version).toBe("0.1.0");
|
||||
});
|
||||
|
||||
test("不支持的 method 在有 API 通配符时返回 404", async () => {
|
||||
@@ -410,6 +412,7 @@ describe("API 路由", () => {
|
||||
config: { host: "127.0.0.1", port: 0 },
|
||||
mode: "production",
|
||||
store,
|
||||
version: "0.1.0",
|
||||
});
|
||||
try {
|
||||
const response = await fetch(`http://127.0.0.1:${prodServer.port}/api/dashboard`);
|
||||
|
||||
Reference in New Issue
Block a user