Skip to content

Commit

Permalink
Fixes failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle committed Dec 11, 2024
1 parent db6ba4a commit 610cb1d
Showing 1 changed file with 31 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,34 +105,37 @@ describe("FlowRunActivityBarChart", () => {
});

it.each([
"COMPLETED",
"FAILED",
"CANCELLED",
"CANCELLING",
"PENDING",
"SCHEDULED",
"PAUSED",
"RUNNING",
"CRASHED",
])("renders the bars with expected colors for %s", (stateType) => {
const enrichedFlowRun = {
...mockFlowRun,
state_type: stateType,
};
render(
<RouterContextProvider router={router}>
<FlowRunActivityBarChart
{...defaultProps}
// @ts-expect-error - Type error from test data not matching schema
enrichedFlowRuns={[enrichedFlowRun]}
/>
</RouterContextProvider>,
);
const bars = screen.getAllByRole("graphics-symbol");
expect(
within(bars[0]).getByTestId("bar-rect-test-flow-run-1"),
).toHaveAttribute("fill", `hsl(var(--state-${stateType.toLowerCase()}))`);
});
["COMPLETED", "fill-green-600"],
["FAILED", "fill-red-600"],
["CANCELLED", "fill-gray-500"],
["CANCELLING", "fill-gray-600"],
["PENDING", "fill-gray-400"],
["SCHEDULED", "fill-yellow-400"],
["PAUSED", "fill-gray-500"],
["RUNNING", "fill-blue-700"],
["CRASHED", "fill-orange-600"],
])(
"renders the bars with expected colors for %s",
(stateType, expectedClass) => {
const enrichedFlowRun = {
...mockFlowRun,
state_type: stateType,
};
render(
<RouterContextProvider router={router}>
<FlowRunActivityBarChart
{...defaultProps}
// @ts-expect-error - Type error from test data not matching schema
enrichedFlowRuns={[enrichedFlowRun]}
/>
</RouterContextProvider>,
);
const bars = screen.getAllByRole("graphics-symbol");
expect(
within(bars[0]).getByTestId("bar-rect-test-flow-run-1"),
).toHaveClass(expectedClass);
},
);

it("applies custom bar width when provided", () => {
const customBarWidth = 12;
Expand Down

0 comments on commit 610cb1d

Please sign in to comment.