Add integration tests for path repeater functionality

This commit is contained in:
2026-05-13 03:53:56 +02:00
parent cee819e0da
commit 6c89fd3d74

View File

@@ -144,6 +144,7 @@ describe("Path inspector", () => {
expect(screen.getByTestId("path-road-terrain-conform")).toBeChecked();
expect(screen.getByTestId("path-road-material")).toHaveValue("");
expect(screen.getByTestId("apply-path-road-to-terrain")).toBeDisabled();
expect(screen.getByTestId("add-path-repeater")).toBeInTheDocument();
expect(screen.getByTestId("path-point-0-x")).toHaveValue(-1);
expect(screen.getByTestId("path-point-1-x")).toHaveValue(1);
@@ -193,6 +194,38 @@ describe("Path inspector", () => {
}
});
fireEvent.click(screen.getByTestId("path-road-terrain-conform"));
fireEvent.click(screen.getByTestId("add-path-repeater"));
expect(screen.getByTestId("path-repeater-0-asset")).toHaveValue(
"fence_segment_wood_2m"
);
expect(screen.getByTestId("path-repeater-0-placement")).toHaveValue(
"left"
);
fireEvent.change(screen.getByTestId("path-repeater-0-asset"), {
target: {
value: "fence_post_wood"
}
});
fireEvent.change(screen.getByTestId("path-repeater-0-placement"), {
target: {
value: "right"
}
});
fireEvent.change(screen.getByTestId("path-repeater-0-offset"), {
target: {
value: "2.25"
}
});
fireEvent.change(screen.getByTestId("path-repeater-0-spacing"), {
target: {
value: "3"
}
});
fireEvent.change(screen.getByTestId("path-repeater-0-yaw-offset"), {
target: {
value: "15"
}
});
fireEvent.change(screen.getByTestId("path-point-1-z"), {
target: {
value: "2"
@@ -221,6 +254,14 @@ describe("Path inspector", () => {
materialId: null
}
});
expect(updatedPath?.repeaters[0]).toMatchObject({
assetId: "fence_post_wood",
enabled: true,
placement: "right",
offset: 2.25,
spacing: 3,
yawOffsetDegrees: 15
});
expect(updatedPath?.points).toHaveLength(3);
expect(updatedPath?.points[1]?.position).toEqual({
x: 1,