Skip to content

Commit a203df6

Browse files
authored
Merge pull request #142 from w3bdesign/development
Fix tests
2 parents 6110e37 + 0fb8114 commit a203df6

File tree

5 files changed

+9
-22299
lines changed

5 files changed

+9
-22299
lines changed

__tests__/Prosjekter/ProsjektCard.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import React from "react";
22
import { render, screen } from "@testing-library/react";
3+
import { mockIntersectionObserver } from "jsdom-testing-mocks";
34

45
import ProsjektCard from "../../src/components/Prosjekter/ProsjektCard.component";
56

7+
mockIntersectionObserver();
8+
69
// Mock the Button component
710
jest.mock(
811
"../../src/components/UI/Button.component",
912
() =>
10-
({ href, renderAs, children }) => <a href={href}>{children}</a>,
13+
({ href, renderAs, children }) => <a href={href}>{children}</a>
1114
);
1215

1316
// Mock the urlFor function
@@ -54,15 +57,15 @@ describe("ProsjektCard", () => {
5457
expect(visitButton).toBeInTheDocument();
5558
expect(visitButton.closest("a")).toHaveAttribute(
5659
"href",
57-
"https://example.com",
60+
"https://example.com"
5861
);
5962

6063
// Check if the "GitHub" button is rendered with the correct href
6164
const githubButton = screen.getByText("GitHub");
6265
expect(githubButton).toBeInTheDocument();
6366
expect(githubButton.closest("a")).toHaveAttribute(
6467
"href",
65-
"https://github.com/example",
68+
"https://github.com/example"
6669
);
6770
});
6871

0 commit comments

Comments
 (0)