automationsSectionOffPeakTelemetry.test.ts 942 B

123456789101112131415161718192021222324252627
  1. // @vitest-environment node
  2. import { describe, expect, it } from "vitest";
  3. import {
  4. buildOffPeakCreateResultTelemetryPayload,
  5. freezeOffPeakCreateTelemetrySnapshot,
  6. } from "@/lib/offPeakTelemetry.js";
  7. describe("offPeakTelemetry helpers used by AutomationsSection (smoke)", () => {
  8. it("灰度门禁失败 payload 含 failure_stage=client_validation", () => {
  9. const snapshot = freezeOffPeakCreateTelemetrySnapshot({
  10. source: { eventRegion: "app.automations", templateId: "ciFlakyReport" },
  11. model: "GLM-5.2",
  12. });
  13. const payload = buildOffPeakCreateResultTelemetryPayload(snapshot, {
  14. ok: false,
  15. failureStage: "client_validation",
  16. errorCategory: "client_validation",
  17. errorCode: "",
  18. providerName: "",
  19. });
  20. expect(payload.eventExtraDetail).toMatchObject({
  21. result: "failure",
  22. failure_stage: "client_validation",
  23. error_category: "client_validation",
  24. });
  25. });
  26. });