Skip to content

Commit

Permalink
Add test for Loading
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuflatland-lf committed Jul 2, 2024
1 parent f26d5a0 commit a0815bc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
33 changes: 33 additions & 0 deletions frontend/src/components/LoadingPage.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom";
import LoadingPage from "./LoadingPage";

describe("LoadingPage", () => {
it("renders without crashing", () => {
render(<LoadingPage />);
expect(screen.getByText("Loading...")).toBeInTheDocument();
});

it("displays the flamingo icon with correct styling", () => {
render(<LoadingPage />);
const flamingoIcon = screen.getByTestId("flamingo-icon");
expect(flamingoIcon).toBeInTheDocument();
expect(flamingoIcon).toHaveClass("text-white text-8xl animate-flip");
});

it("displays the loading text with correct styling", () => {
render(<LoadingPage />);
const loadingText = screen.getByText("Loading...");
expect(loadingText).toBeInTheDocument();
expect(loadingText).toHaveClass("text-lg text-white mt-4");
});

it("has the correct background styling", () => {
render(<LoadingPage />);
const container = screen.getByTestId("loading-container");
expect(container).toHaveClass(
"bg-pink-700 flex flex-col items-center justify-center h-screen bg-gray-100",
);
});
});
11 changes: 8 additions & 3 deletions frontend/src/components/LoadingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
// LoadingPage.tsx
import React from "react";
import { GiFlamingo } from "react-icons/gi";

function LoadingPage() {
return (
<div className="bg-pink-700 flex flex-col items-center justify-center h-screen bg-gray-100">
<GiFlamingo className="text-white text-8xl animate-flip" />
<div
className="bg-pink-700 flex flex-col items-center justify-center h-screen bg-gray-100"
data-testid="loading-container"
>
<GiFlamingo
className="text-white text-8xl animate-flip"
data-testid="flamingo-icon"
/>
<p className="text-lg text-white mt-4">Loading...</p>
</div>
);
Expand Down

0 comments on commit a0815bc

Please sign in to comment.