import { getBurstLocationErrorNotice } from "./burstLocationError"; describe("getBurstLocationErrorNotice", () => { it("explains a missing realtime normal-pressure baseline", () => { const notice = getBurstLocationErrorNotice({ response: { data: { detail: "正常压力数据 在时间窗内无有效模拟数据: 10186", }, }, }); expect(notice.message).toBe("缺少正常模拟基线"); expect(notice.description).toContain("实时模拟正常压力数据"); expect(notice.description).toContain("10186"); expect(notice.description).toContain("系统不会自动补数据"); }); it("distinguishes incomplete burst-scheme data", () => { const notice = getBurstLocationErrorNotice({ response: { data: { detail: "爆管压力数据 在时间窗内无有效模拟数据: 10186", }, }, }); expect(notice).toEqual({ message: "所选方案数据不完整", description: "所选方案时间窗内没有可用的爆管压力数据,缺失点位:10186。请选择数据完整的模拟方案。", }); }); it("preserves unrelated backend details", () => { expect( getBurstLocationErrorNotice({ response: { data: { detail: "分析参数不合法" } }, }), ).toEqual({ message: "提交分析失败", description: "分析参数不合法", }); }); });