Skip to content

Commit e4e3c16

Browse files
committed
Fix Jest
1 parent 28cf681 commit e4e3c16

File tree

1 file changed

+44
-12
lines changed

1 file changed

+44
-12
lines changed

__tests__/CV/CVContent.test.tsx

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,54 @@
22
* @jest-environment jsdom
33
*/
44

5+
import React from "react";
56
import { render, screen } from "@testing-library/react";
6-
77
import CVContent from "../../src/components/CV/CVContent.component";
88

9+
const mockCVData = {
10+
keyQualifications: ["Qualification 1", "Qualification 2"],
11+
experience: [
12+
{
13+
period: "2020-2022",
14+
company: "Example Company",
15+
role: "Software Developer",
16+
description: "Worked on various projects",
17+
},
18+
],
19+
education: [
20+
{
21+
period: "2016-2020",
22+
institution: "University of Example",
23+
degree: "Bachelor in Computer Science",
24+
description: "Studied various aspects of computer science",
25+
},
26+
],
27+
};
28+
929
describe("CVContent", () => {
10-
it("CVContent laster inn og kan vises", () => {
11-
render(<CVContent />);
12-
const cvcontent = screen.getByRole("heading", { name: /cv/i });
13-
expect(cvcontent).toBeInTheDocument();
14-
});
30+
it("CVContent renders correctly with mock data", () => {
31+
render(<CVContent cvData={mockCVData} />);
32+
33+
// Check if the CV header is present
34+
const cvHeader = screen.getByRole("heading", { name: /cv/i });
35+
expect(cvHeader).toBeInTheDocument();
36+
37+
// Check if the "Last ned PDF" button is present
38+
const pdfButton = screen.getByRole("link", { name: /last ned pdf/i });
39+
expect(pdfButton).toBeInTheDocument();
40+
41+
// Check if tabs are present
42+
const qualificationsTab = screen.getByRole("tab", {
43+
name: /nøkkelkvalifikasjoner/i,
44+
});
45+
const experienceTab = screen.getByRole("tab", { name: /erfaring/i });
46+
const educationTab = screen.getByRole("tab", { name: /utdanning/i });
47+
expect(qualificationsTab).toBeInTheDocument();
48+
expect(experienceTab).toBeInTheDocument();
49+
expect(educationTab).toBeInTheDocument();
1550

16-
/*
17-
it("PDF laster inn og kan vises", async () => {
18-
render(<CVContent />);
19-
const pdf = await screen.findByText(/nøkkelkvalifikasjoner/i);
20-
expect(pdf).toBeInTheDocument();
51+
// Check if mock data is rendered (you might need to click on tabs to see this content)
52+
const qualification = screen.getByText(/qualification 1/i);
53+
expect(qualification).toBeInTheDocument();
2154
});
22-
*/
2355
});

0 commit comments

Comments
 (0)