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.

Add test for edit and delete resume

Khuram Niazbbae5049b528
diff --git a/e2e/profile.spec.ts b/e2e/profile.spec.ts
index b46e7d2..e6c78b7 100644
--- a/e2e/profile.spec.ts
+++ b/e2e/profile.spec.ts
@@ -26,6 +26,32 @@ test.describe("Profile page", () => {
await expect(page.locator("tbody")).toContainText("Test Resume 1");
});
- test("should edit the resume title", async ({ page }) => {});
- test("should delete a resume", async ({ page }) => {});
+ test("should edit the resume title", async ({ page }) => {
+ await page.getByRole("link", { name: "Profile" }).click();
+ await page.getByTestId("resume-actions-menu-btn").first().click();
+ await page.getByRole("menuitem", { name: "Edit Resume Title" }).click();
+ await page
+ .getByPlaceholder("Ex: Full Stack Developer")
+ .fill("Test Resume 1 edited");
+ await page.getByRole("button", { name: "Save" }).click();
+ await expect(page.getByRole("status")).toHaveText(
+ /Resume title has been updated/
+ );
+ await expect(page.locator("tbody")).toContainText("Test Resume 1 edited");
+ });
+ test("should delete a resume", async ({ page }) => {
+ await page.getByRole("link", { name: "Profile" }).click();
+ await page.getByTestId("resume-actions-menu-btn").first().click();
+ await page.getByRole("menuitem", { name: "Delete" }).click();
+ await expect(page.getByRole("alertdialog")).toContainText(
+ "Are you sure you want to delete this resume?"
+ );
+ await page.getByRole("button", { name: "Delete" }).click();
+ await expect(page.getByRole("status").first()).toContainText(
+ /Resume has been deleted successfully/
+ );
+ await expect(page.locator("tbody")).not.toContainText(
+ "Test Resume 1 edited"
+ );
+ });
});
diff --git a/src/actions/profile.actions.ts b/src/actions/profile.actions.ts
index e308de9..6b1525b 100644
--- a/src/actions/profile.actions.ts
+++ b/src/actions/profile.actions.ts
@@ -252,7 +252,7 @@ export const deleteResumeById = async (
// TODO: Check if resume is associated with any job
await prisma.$transaction(async (prisma) => {
- await prisma.contactInfo.delete({
+ await prisma.contactInfo.deleteMany({
where: {
resumeId: resumeId,
},
diff --git a/src/components/profile/ResumeTable.tsx b/src/components/profile/ResumeTable.tsx
index 8ee5a71..e670d63 100644
--- a/src/components/profile/ResumeTable.tsx
+++ b/src/components/profile/ResumeTable.tsx
@@ -114,7 +114,12 @@ ResumeTableProps) {
<TableCell>
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button aria-haspopup="true" size="icon" variant="ghost">
+ <Button
+ aria-haspopup="true"
+ size="icon"
+ variant="ghost"
+ data-testid="resume-actions-menu-btn"
+ >
<MoreHorizontal className="h-4 w-4" />
<span className="sr-only">Toggle menu</span>
</Button>