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.

Address failing unit tests

Khuram Niaz5816408a7d0c
diff --git a/__tests__/company.actions.spec.ts b/__tests__/company.actions.spec.ts
index bdf4ce3..3f84581 100644
--- a/__tests__/company.actions.spec.ts
+++ b/__tests__/company.actions.spec.ts
@@ -392,7 +392,7 @@ describe("Company Actions", () => {
});
expect(prisma.company.update).toHaveBeenCalledWith({
- where: { id: "company-id" },
+ where: { id: "company-id", createdBy: "user-id" },
data: {
value: "updated company",
label: "Updated Company",
@@ -438,7 +438,7 @@ describe("Company Actions", () => {
expect(result).toEqual({
success: false,
- message: "Id is not provided or no user privilages",
+ message: "Company id is required",
});
expect(prisma.company.findFirst).not.toHaveBeenCalled();
@@ -524,7 +524,7 @@ describe("Company Actions", () => {
const result = await getCompanyById(mockCompanyId);
expect(prisma.company.findUnique).toHaveBeenCalledWith({
- where: { id: mockCompanyId },
+ where: { id: mockCompanyId, createdBy: "user-id" },
});
expect(result).toEqual(mockCompany);
@@ -562,7 +562,7 @@ describe("Company Actions", () => {
});
expect(prisma.company.findUnique).toHaveBeenCalledWith({
- where: { id: mockCompanyId },
+ where: { id: mockCompanyId, createdBy: "user-id" },
});
});
});
diff --git a/__tests__/coverLetter.actions.spec.ts b/__tests__/coverLetter.actions.spec.ts
index 6dab736..7f93591 100644
--- a/__tests__/coverLetter.actions.spec.ts
+++ b/__tests__/coverLetter.actions.spec.ts
@@ -276,7 +276,7 @@ describe("coverLetterActions", () => {
data: updated,
});
expect(prisma.coverLetter.update).toHaveBeenCalledWith({
- where: { id: "cl-id" },
+ where: { id: "cl-id", profile: { userId: "user-id" } },
data: { title: "Updated Title", content: "Updated content for the cover letter." },
});
});
@@ -318,7 +318,7 @@ describe("coverLetterActions", () => {
expect(result).toEqual({ success: true });
expect(prisma.coverLetter.delete).toHaveBeenCalledWith({
- where: { id: "cl-id" },
+ where: { id: "cl-id", profile: { userId: "user-id" } },
});
});
diff --git a/__tests__/job.actions.spec.ts b/__tests__/job.actions.spec.ts
index 4d07a71..d3fac4a 100644
--- a/__tests__/job.actions.spec.ts
+++ b/__tests__/job.actions.spec.ts
@@ -368,6 +368,7 @@ describe("jobActions", () => {
expect(prisma.job.findUnique).toHaveBeenCalledWith({
where: {
id: "2",
+ userId: "user-id",
},
include: {
JobSource: true,
@@ -577,7 +578,7 @@ describe("jobActions", () => {
updateJob({ ...jobData, id: undefined }),
).resolves.toStrictEqual({
success: false,
- message: "Id is not provide or no user privilages",
+ message: "Job id is required",
});
});
});