1
0

refactor: 移除 success 字段,简化为 matched 单层判定模型

This commit is contained in:
2026-05-11 13:12:55 +08:00
parent 548b44d28e
commit 35ba56888b
93 changed files with 3893 additions and 103 deletions

View File

@@ -132,7 +132,6 @@ describe("ProbeStore", () => {
store.insertCheckResult({
targetId: t1Id,
timestamp: "2025-01-01T00:00:00.000Z",
success: true,
matched: true,
durationMs: 150.5,
statusDetail: "200 OK",
@@ -142,7 +141,6 @@ describe("ProbeStore", () => {
store.insertCheckResult({
targetId: t1Id,
timestamp: "2025-01-01T00:00:30.000Z",
success: true,
matched: true,
durationMs: 300,
statusDetail: "200 OK",
@@ -161,7 +159,6 @@ describe("ProbeStore", () => {
store.insertCheckResult({
targetId: t1Id,
timestamp: "2025-01-01T00:01:00.000Z",
success: false,
matched: false,
durationMs: null,
statusDetail: null,
@@ -173,7 +170,7 @@ describe("ProbeStore", () => {
expect(history.items[0]!.timestamp).toBe("2025-01-01T00:01:00.000Z");
const latest = store.getLatestCheck(t1Id)!;
expect(latest.success).toBe(0);
expect(latest.matched).toBe(0);
expect(latest.failure).not.toBeNull();
const parsedFailure = JSON.parse(latest.failure!) as CheckFailure;
expect(parsedFailure.kind).toBe("error");
@@ -189,7 +186,6 @@ describe("ProbeStore", () => {
store.insertCheckResult({
targetId: t1Id,
timestamp: `2025-01-01T01:${String(i).padStart(2, "0")}:00.000Z`,
success: true,
matched: true,
durationMs: 100 + i,
statusDetail: "200 OK",
@@ -250,7 +246,6 @@ describe("ProbeStore", () => {
expect(samples.length).toBeGreaterThan(0);
for (const sample of samples) {
expect(typeof sample.timestamp).toBe("string");
expect(typeof sample.success).toBe("number");
expect(typeof sample.matched).toBe("number");
}
});