From b653ec7cba85d19b2832500081e7768dbf419edb Mon Sep 17 00:00:00 2001 From: SeonjaeLee Date: Fri, 27 Dec 2024 00:02:44 +0900 Subject: [PATCH] test: render test leaderboard link --- src/pages/Certificate/Certificate.test.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/pages/Certificate/Certificate.test.tsx b/src/pages/Certificate/Certificate.test.tsx index 5c63a5b..add870f 100644 --- a/src/pages/Certificate/Certificate.test.tsx +++ b/src/pages/Certificate/Certificate.test.tsx @@ -173,6 +173,27 @@ test("render content solved problems, cohort", () => { }); }); +test("render learderboard link", () => { + vi.mocked(useMembers).mockReturnValue( + mock({ + isLoading: false, + error: null, + members: [mock({ id: "test1", name: "테스트1" })], + totalCohorts: 0, + filter: { name: "", cohort: null }, + setFilter: vi.fn(), + }), + ); + + location.href = new URL(`?member=test1`, location.href).toString(); + render(); + + const leaderboardLink = screen.getByRole("link", { + name: "리더보드로 돌아가기", + }); + expect(leaderboardLink).toHaveAttribute("href", `/`); +}); + test("render print button", () => { vi.mocked(useMembers).mockReturnValue( mock({