-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests added from Eduardo de Valle to NoDataCard.test.tsx
- Loading branch information
1 parent
e02f808
commit 888cfa8
Showing
2 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { describe, it, expect } from "vitest"; | ||
import NoDataCard from "@/components/NoDataCard"; | ||
|
||
describe("NoDataCard Component", () => { | ||
// José Eduardo de Valle Lara A01734957 - Test #6/10 | ||
it("renders correctly with provided text", () => { | ||
const testText = "No data available"; | ||
render(<NoDataCard text={testText} />); | ||
|
||
const textElement = screen.getByText(testText); | ||
expect(textElement).toBeInTheDocument(); | ||
expect(textElement).toHaveClass( | ||
"text-center text-sm font-medium text-grayText", | ||
); | ||
}); | ||
|
||
// José Eduardo de Valle Lara A01734957 - Test #7/10 | ||
it("renders image on medium and larger screens", () => { | ||
render(<NoDataCard text="No data available" />); | ||
|
||
const imageElement = screen.getByAltText("No Data Image"); | ||
Check failure on line 23 in test/NoDataCard.test.tsx GitHub Actions / unit-testtest/NoDataCard.test.tsx > NoDataCard Component > renders image on medium and larger screens
|
||
expect(imageElement).toBeInTheDocument(); | ||
expect(imageElement).toHaveClass("hidden md:block"); | ||
}); | ||
|
||
// José Eduardo de Valle Lara A01734957 - Test #8/10 | ||
it("contains the provided text", () => { | ||
const testText = "No data available"; | ||
render(<NoDataCard text={testText} />); | ||
|
||
const textElement = screen.getByText(testText); | ||
expect(textElement).toBeInTheDocument(); | ||
expect(textElement).toHaveTextContent(testText); | ||
}); | ||
}); |