feat(infra): 落地 M01 基础框架与本机开发环境
交付 FastAPI/Celery/Vue 薄壳、FORCE RLS、Compose 回环与 review 修复证据,关闭 M01 DONE_LOCAL。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8b2a809f06
commit
8fb16f4a4a
97 files changed
+8059
-22
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { BusinessError } from "@watchman/api";
|
||||
import { healthFailureView, healthSuccessView } from "./health";
|
||||
|
||||
describe("health view mapping", () => {
|
||||
it("maps success payload", () => {
|
||||
const view = healthSuccessView({
|
||||
status: "ok",
|
||||
app: "watchman",
|
||||
version: "0.1.0",
|
||||
});
|
||||
expect(view).toEqual({
|
||||
state: "success",
|
||||
detail: "watchman 0.1.0",
|
||||
});
|
||||
});
|
||||
|
||||
it("maps BusinessError failure", () => {
|
||||
const view = healthFailureView(
|
||||
new BusinessError({
|
||||
code: 50000,
|
||||
message: "Service error",
|
||||
status: 500,
|
||||
requestId: "req-1",
|
||||
}),
|
||||
);
|
||||
expect(view.state).toBe("failure");
|
||||
expect(view.detail).toContain("50000");
|
||||
expect(view.detail).toContain("Service error");
|
||||
});
|
||||
|
||||
it("maps unknown failure", () => {
|
||||
const view = healthFailureView(new Error("network down"));
|
||||
expect(view).toEqual({
|
||||
state: "failure",
|
||||
detail: "Error: network down",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user