Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Asiern committed Feb 7, 2024
1 parent e454c42 commit a5f6d3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
30 changes: 6 additions & 24 deletions __tests__/components/Run/Run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,26 @@ beforeAll(() => {

describe("Run component", () => {
it("displays place correctly", async () => {
const { getByText } = render(
<Run
place={20}
players={"Player"}
time="1h22m5s"
weblink={runData.weblink}
/>
);
const { getByText } = render(<Run place={20} run={runData} />);
const place = getByText("20");
expect(place).toBeDefined();
});
it("displays time correctly", async () => {
const time = "1h22m5s";
const time = "00:31:22";
const { getByText } = render(
<Run
place={20}
players={"Player"}
time={time}
weblink={runData.weblink}
/>
<Run place={20} run={runData} />
);
const timeComp = getByText(time);
expect(timeComp).toBeDefined();
});
it("navigates to RunInfo screen when pressed", () => {
const { getByTestId } = render(
<Run
place={20}
players={"Player"}
time="1h22m5s"
weblink={runData.weblink}
/>
);
const { getByTestId } = render(<Run place={20} run={runData} />);
const touchable = getByTestId("run-touchable");
fireEvent.press(touchable);
const navigation = useNavigation();
expect(navigation.navigate).toHaveBeenCalledWith("RunInfo", {
weblink: runData.weblink,
run: runData,
place: 20,
});
});
});
3 changes: 2 additions & 1 deletion __tests__/screens/profile/PB.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ describe("PB component", () => {
const navigation = useNavigation();

expect(navigation.navigate).toBeCalledWith("RunInfo", {
weblink: pbData.run.weblink,
run: pbData.run,
place: pbData.place,
});
});
});

0 comments on commit a5f6d3a

Please sign in to comment.