feat: add logto auth and backend metrics integration

This commit is contained in:
2026-04-22 15:52:12 +08:00
parent b1bb28f5aa
commit c7ae2fbfcb
38 changed files with 4886 additions and 34 deletions
+41
View File
@@ -0,0 +1,41 @@
import { describe, expect, test } from "vitest";
import {
isBackendMetricsResponseMessage,
isBackendMetricsSearchRequestMessage
} from "../src/shared/backend-metrics-messages";
describe("backend-metrics-messages", () => {
test("accepts a backend metrics search request", () => {
expect(
isBackendMetricsSearchRequestMessage({
type: "backend-metrics:search",
value: {
starIds: ["111", "222"]
}
})
).toBe(true);
});
test("accepts a successful backend metrics response", () => {
expect(
isBackendMetricsResponseMessage({
ok: true,
type: "backend-metrics:result",
value: {
rows: [
{
a3IncreaseCount: "10.00",
afterViewSearchCount: "20.00",
afterViewSearchRate: "0.20%",
cpSearch: "1.10",
cpa3: "2.20",
newA3Rate: "1.50%",
starId: "111"
}
]
}
})
).toBe(true);
});
});