Skip to content

Commit

Permalink
fix : refactor test and remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTheKorean committed Oct 25, 2024
1 parent f13112a commit 8b0ba70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/components/leaderboard/leaderboard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, test } from "vitest";
import { beforeEach, describe, expect, it } from "vitest";
import { render, screen } from "@testing-library/react";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
Expand All @@ -19,12 +19,12 @@ describe("<Leaderboard/>", () => {
),
);

test("renders the title", () => {
it("renders the title", () => {
const heading = screen.getByRole("heading", { level: 1 });
expect(heading).toHaveTextContent("Leaderboard");
});

test("renders the member information", () => {
it("renders the member information", () => {
const members = [
{ name: "DaleSeo", solved: 71, rank: "새싹" },
{ name: "sounmind", solved: 69, rank: "나무" },
Expand All @@ -45,7 +45,7 @@ describe("<Leaderboard/>", () => {
});
});

test("renders the links for members", () => {
it("renders the links for members", () => {
const members = [
{ name: "DaleSeo" },
{ name: "sounmind" },
Expand Down
22 changes: 0 additions & 22 deletions src/components/leaderboard/leaderboard.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
import { useQuery } from "@tanstack/react-query";

/* NOTE: 임시 코드, 추후 삭제 예정 */
const fetchViteSvg = async () => {
const response = await fetch("/vite.svg");
if (!response.ok) {
throw new Error("SVG 파일을 가져오는 데 실패했습니다.");
}
const blob = await response.blob();
return URL.createObjectURL(blob);
};

export default function Leaderboard() {
const members = [
{ name: "DaleSeo", solved: 71, rank: "새싹" },
Expand All @@ -20,18 +8,8 @@ export default function Leaderboard() {
{ name: "SamTheKorean", solved: 60, rank: "나무" },
];

/* NOTE: 임시 코드, 추후 삭제 예정 */
const { data: viteSvg, isLoading: isViteSvgLoading } = useQuery({
queryKey: ["vite.svg"],
queryFn: fetchViteSvg,
});

return (
<main>
{/* NOTE: 임시 코드, 추후 삭제 예정 */}
{isViteSvgLoading && <p>Loading...</p>}
{viteSvg && <img src={viteSvg} alt="Vite" />}

<h1>Leaderboard</h1>

<section aria-labelledby="leaderboard">
Expand Down

0 comments on commit 8b0ba70

Please sign in to comment.