Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Fix failing unit tests

Khuram Niaz6979b8cbd0cb
diff --git a/__tests__/ProfileContainer.spec.tsx b/__tests__/ProfileContainer.spec.tsx
index 45cf6f5..cb26e04 100644
--- a/__tests__/ProfileContainer.spec.tsx
+++ b/__tests__/ProfileContainer.spec.tsx
@@ -1,4 +1,5 @@
-import { act, fireEvent, render, screen } from "@testing-library/react";
+import { act, render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import "@testing-library/jest-dom";
import ProfileContainer from "@/components/profile/ProfileContainer";
import React from "react";
@@ -14,6 +15,17 @@ jest.mock("@/actions/profile.actions", () => ({
),
}));
+jest.mock("@/actions/coverLetter.actions", () => ({
+ getCoverLetterList: jest.fn(() =>
+ Promise.resolve({
+ data: [],
+ total: 0,
+ success: true,
+ message: "",
+ }),
+ ),
+}));
+
describe("ProfileContainer Component", () => {
beforeEach(async () => {
jest.clearAllMocks();
@@ -30,12 +42,15 @@ describe("ProfileContainer Component", () => {
});
it("should open the create resume dialog upon clicking create resume button", async () => {
- const createResumeButton = screen.getByRole("button", {
- name: /new resume/i,
- });
- await act(async () => {
- fireEvent.click(createResumeButton);
+ const user = userEvent.setup();
+
+ const newButton = screen.getByRole("button", {
+ name: /new/i,
});
+ await user.click(newButton);
+
+ const addResumeItem = await screen.findByText(/add new resume/i);
+ await user.click(addResumeItem);
expect(screen.getByRole("dialog")).toBeInTheDocument();
expect(
diff --git a/__tests__/job.actions.spec.ts b/__tests__/job.actions.spec.ts
index 5cb0cfc..15588c0 100644
--- a/__tests__/job.actions.spec.ts
+++ b/__tests__/job.actions.spec.ts
@@ -372,6 +372,7 @@ describe("jobActions", () => {
JobSource: true,
JobTitle: true,
Company: true,
+ CoverLetter: true,
Status: true,
Location: true,
Resume: {