Skip to content

Commit cf84e84

Browse files
committed
fix: test the rendered metatags
1 parent 6944c57 commit cf84e84

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

__tests__/components/ui/MetaData.test.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import { getMetadataDescription } from "@/utilities/Metadata";
33
import "@testing-library/jest-dom";
44
import { render, screen } from "@testing-library/react";
55

6-
describe("MetaData", () => {
7-
const description = "Test description";
6+
const description = "Test description";
7+
const expectedMetaTags = getMetadataDescription(description);
88

9-
it("should render metaData", () => {
9+
describe("MetaData", () => {
10+
it("should render metaData tags", () => {
1011
render(<MetaData description={description} />);
11-
const metadata = screen.queryByTestId("meta-id");
12-
expect(metadata).toBeInTheDocument();
12+
const metaTags = screen.getAllByTestId("meta-id");
13+
expect(metaTags).toHaveLength(expectedMetaTags.length);
1314
});
1415

15-
it("should render meta tags", () => {
16+
it("should render the correct content in the meta tags", () => {
1617
render(<MetaData description={description} />);
1718
const mockMetas = getMetadataDescription(description);
1819
mockMetas.forEach((meta, index) => {

0 commit comments

Comments
 (0)