Skip to content

Commit d5dbea7

Browse files
committed
Updated test based on feedback
1 parent cc49159 commit d5dbea7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/bar-chart/BarChart.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { render, waitFor } from "@testing-library/react";
2+
import { getByRole, render } from "@testing-library/react";
33
import DxcBarChart from "./BarChart";
44
import userEvent from "@testing-library/user-event";
55

@@ -90,7 +90,7 @@ describe("Bar Chart component tests", () => {
9090
});
9191
test("onRetry is called when the retry button is clicked", async () => {
9292
const onRetry = jest.fn();
93-
const { getByText } = render(
93+
const { getByText, getByRole } = render(
9494
<DxcBarChart
9595
onRetry={onRetry}
9696
error="Error"
@@ -115,7 +115,7 @@ describe("Bar Chart component tests", () => {
115115
/>
116116
);
117117
expect(getByText("Error")).toBeTruthy();
118-
await userEvent.click(getByText("Retry"));
118+
await userEvent.click(getByRole("button"));
119119
expect(onRetry).toHaveBeenCalled();
120120
});
121121
});

0 commit comments

Comments
 (0)