import { describe, expect, it } from "vitest"; import { diffAxelTraces, normalizeAxelSequence, type AxelTraceEvent, } from "../../../scripts/lib/axel-event-tracer"; describe("axel-event-tracer", () => { it("diff 识别 RPA 缺失 place commit", () => { const manual: AxelTraceEvent[] = [ { at: 1, phase: "manual-pickup", method: "POST", url: "https://services.mothership.com/axel/location/search", status: 200, kind: "search", searchPlaceIds: ["ChIJ_manual"], }, { at: 2, phase: "manual-pickup", method: "GET", url: "https://services.mothership.com/axel/location/place/ChIJ_manual", status: 200, kind: "place", placeId: "ChIJ_manual", }, ]; const rpa: AxelTraceEvent[] = [ { at: 1, phase: "rpa-fillAddress", method: "POST", url: "https://services.mothership.com/axel/location/search", status: 200, kind: "search", searchPlaceIds: ["ChIJ_manual"], }, ]; const diff = diffAxelTraces(manual, rpa); expect(diff.verdict).toBe("RPA_MISSING_PLACE_COMMIT"); expect(diff.manualPlaceCommits).toEqual(["ChIJ_manual"]); expect(diff.rpaPlaceCommits).toEqual([]); expect(normalizeAxelSequence(manual).some((l) => l.includes("GET place/ChIJ_manual"))).toBe( true, ); }); });