refactor(frontend): align TJWater Next integrations

This commit is contained in:
2026-08-26 12:26:29 +08:00
parent 6623f4f7fb
commit fee4fc6ce1
51 changed files with 3074 additions and 22280 deletions
@@ -21,7 +21,7 @@ jest.mock("@/utils/mapQueryService", () => ({
}));
const scheme: SchemeRecord = {
id: 17,
id: "17",
schemeName: "burst-report-demo",
type: "burst_analysis",
username: "operator",
@@ -52,10 +52,12 @@ const feature = (id: string, diameter: number) => ({
describe("AnalysisReport", () => {
beforeEach(() => {
(queryFeaturesByIds as jest.Mock).mockImplementation(
async (_ids: string[], layerName: string) =>
layerName === "geo_pipes_mat"
? [feature("P-1", 315)]
: [feature("P-2", 800)],
async (ids: string[], layerName: string) =>
layerName === "pipes"
? ids.map((id) =>
id === "P-1" ? feature(id, 315) : feature(id, 800),
)
: [],
);
});
@@ -109,8 +111,8 @@ describe("AnalysisReport", () => {
expect(preview.getByText("800 mm")).toBeInTheDocument();
});
expect(queryFeaturesByIds).toHaveBeenCalledWith(
["P-2"],
"geo_pipes",
["P-1", "P-2"],
"pipes",
);
});
@@ -263,7 +265,7 @@ describe("AnalysisReport", () => {
),
).toBeInTheDocument(),
);
expect(queryFeaturesByIds).toHaveBeenCalledTimes(2);
expect(queryFeaturesByIds).toHaveBeenCalledTimes(1);
firstRender.unmount();
render(<AnalysisReport {...props} />);
@@ -273,6 +275,6 @@ describe("AnalysisReport", () => {
"800 mm",
),
).toBeInTheDocument();
expect(queryFeaturesByIds).toHaveBeenCalledTimes(2);
expect(queryFeaturesByIds).toHaveBeenCalledTimes(1);
});
});