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 job action tests

Khuram Niaze492dd663179
diff --git a/__tests__/AddJob.spec.tsx b/__tests__/AddJob.spec.tsx
index 409e834..c090cb0 100644
--- a/__tests__/AddJob.spec.tsx
+++ b/__tests__/AddJob.spec.tsx
@@ -57,6 +57,7 @@ describe("AddJob Component", () => {
const user = userEvent.setup({ skipHover: true });
window.HTMLElement.prototype.scrollIntoView = jest.fn(); // Fixes the issue with combobox
window.HTMLElement.prototype.hasPointerCapture = jest.fn();
+
beforeEach(async () => {
const mockCompanies = (await getMockList(1, 10, "companies")).data;
const mockJobTitles = (await getMockList(1, 10, "jobTitles")).data;
diff --git a/__tests__/job.actions.spec.ts b/__tests__/job.actions.spec.ts
index 5081ad2..fdab6bf 100644
--- a/__tests__/job.actions.spec.ts
+++ b/__tests__/job.actions.spec.ts
@@ -10,6 +10,7 @@ import {
updateJobStatus,
} from "@/actions/job.actions";
import { getMockJobDetails, getMockJobsList } from "@/lib/mock.utils";
+import { JobResponse } from "@/models/job.model";
import { getCurrentUser } from "@/utils/user.utils";
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
@@ -64,6 +65,7 @@ describe("jobActions", () => {
jobUrl: "https://example.com/job",
applied: true,
userId: mockUser.id,
+ resume: "",
};
beforeEach(() => {
jest.clearAllMocks();
@@ -200,6 +202,11 @@ describe("jobActions", () => {
Company: true,
Status: true,
Location: true,
+ Resume: {
+ include: {
+ File: true,
+ },
+ },
},
});
});
@@ -302,6 +309,7 @@ describe("jobActions", () => {
userId: mockUser.id,
jobUrl: jobData.jobUrl,
applied: jobData.applied,
+ resumeId: jobData.resume,
},
});
});
@@ -330,6 +338,7 @@ describe("jobActions", () => {
jobType: jobData.type,
userId: mockUser.id,
applied: jobData.applied,
+ resumeId: jobData.resume,
},
});
expect(result).toEqual({ job: jobData, success: true });
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.ts
index d7a5cb5..a681fd7 100644
--- a/src/actions/job.actions.ts
+++ b/src/actions/job.actions.ts
@@ -253,7 +253,7 @@ export const updateJob = async (
resumeId: resume,
},
});
- revalidatePath("/dashboard/myjobs", "page");
+ // revalidatePath("/dashboard/myjobs", "page");
return { job, success: true };
} catch (error) {
const msg = "Failed to update job. ";