Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

test: align merged username and offer fixtures

Amruth Pillai008ae6d62f73
diff --git a/packages/api/src/features/documents/service.integration.test.ts b/packages/api/src/features/documents/service.integration.test.ts
index 672a38bb3..9fcb95e50 100644
--- a/packages/api/src/features/documents/service.integration.test.ts
+++ b/packages/api/src/features/documents/service.integration.test.ts
@@ -753,40 +753,46 @@ describe.skipIf(!databaseUrl)("Trash batch operations", () => {
}, 30_000);
it("sends a renamed account's old public links to its new username for 30 days, and only its own", async () => {
await seed();
+ const oldUsername = `${schemaName}-alice`;
+ const newUsername = `${schemaName}-alice-new`;
const db = getDb();
await db.update(tables.resume).set({ isPublic: true }).where(eq(tables.resume.id, "alice-active"));
await db
.update(tables.user)
- .set({ username: "alice-new", displayUsername: "alice-new" })
+ .set({ username: newUsername, displayUsername: newUsername })
.where(eq(tables.user.id, "alice"));
const { loadPublicWebPage } = await import("../resume/web-page");
const visit = (match: { username: string; slug: string } | { username: string; primary: true }) =>
loadPublicWebPage({ match, requestHeaders: new Headers(), trustedClient: "test" });
- await expect(visit({ username: "alice", slug: "active" })).resolves.toEqual({
+ await expect(visit({ username: oldUsername, slug: "active" })).resolves.toEqual({
status: "moved",
- username: "alice-new",
+ username: newUsername,
slug: "active",
isPrimary: false,
movedBy: "username",
});
- await expect(visit({ username: "Alice", slug: "active" })).resolves.toMatchObject({ status: "moved" });
+ await expect(visit({ username: oldUsername.toUpperCase(), slug: "active" })).resolves.toMatchObject({
+ status: "moved",
+ });
// Another account never answers for a name it didn't release.
- await expect(visit({ username: "bob", slug: "active" })).resolves.toEqual({ status: "unavailable" });
+ await expect(visit({ username: `${schemaName}-bob`, slug: "active" })).resolves.toEqual({ status: "unavailable" });
// The primary resume's short link moves to the new short link.
await db.update(tables.resume).set({ isPrimary: true }).where(eq(tables.resume.id, "alice-active"));
- await expect(visit({ username: "alice", primary: true })).resolves.toEqual({
+ await expect(visit({ username: oldUsername, primary: true })).resolves.toEqual({
status: "moved",
- username: "alice-new",
+ username: newUsername,
slug: "active",
isPrimary: true,
movedBy: "username",
});
// After 30 days the name is free for anyone, so the old links stop resolving to this account.
- await pool.query(`UPDATE released_username SET released_at = now() - interval '31 days' WHERE username = 'alice'`);
- await expect(visit({ username: "alice", slug: "active" })).resolves.toEqual({ status: "unavailable" });
+ await pool.query("UPDATE released_username SET released_at = now() - interval '31 days' WHERE username = $1", [
+ oldUsername,
+ ]);
+ await expect(visit({ username: oldUsername, slug: "active" })).resolves.toEqual({ status: "unavailable" });
}, 30_000);
it("names a second import of the same person apart from the first, ignoring Trash and other accounts", async () => {
await seed();
diff --git a/tests/e2e/specs/power-user.spec.ts b/tests/e2e/specs/power-user.spec.ts
index 5b00b4063..f6fba3709 100644
--- a/tests/e2e/specs/power-user.spec.ts
+++ b/tests/e2e/specs/power-user.spec.ts
@@ -224,7 +224,7 @@ test("Applications, Career Today and Offers read one next-step rule", async ({ a
/Niantic/,
]);
const rowFor = (company: string) => page.locator("tr[data-application-id]").filter({ hasText: company });
- await expect(rowFor("Ubisoft")).toContainText("Decide on the offer");
+ await expect(rowFor("Ubisoft")).toContainText("Add the offer's terms");
await expect(rowFor("Insomniac")).toContainText("Waiting for interview feedback");
await expect(rowFor("Bungie")).toContainText("Waiting to hear back");
await expect(page.getByText("2 applications need a follow-up.", { exact: true })).toBeVisible();
@@ -239,7 +239,7 @@ test("Applications, Career Today and Offers read one next-step rule", async ({ a
await page.goto("/dashboard/career");
const needsYou = page.locator("section[aria-labelledby='needs-you']");
await expect(needsYou.getByText("3", { exact: true })).toBeVisible();
- await expect(needsYou.getByText("Decide on the offer")).toBeVisible();
+ await expect(needsYou.getByText("Add the offer's terms")).toBeVisible();
await expect(needsYou.getByText("No reply in 35 days")).toBeVisible();
await expect(needsYou.getByText("No reply in 21 days")).toBeVisible();
await expect(needsYou.getByText("You're up to date")).toHaveCount(0);
@@ -255,6 +255,14 @@ test("Applications, Career Today and Offers read one next-step rule", async ({ a
list.find((row: { company: string }) => row.company === "Ubisoft").id,
);
await capture(page, testInfo, "offers-stage.png");
+ await pending.getByLabel("Currency").fill("EUR");
+ await pending.getByLabel("Base salary").fill("182000");
+ await pending.getByRole("button", { name: "Save offer" }).click();
+ await expect(page.getByText("No offers to compare yet")).toHaveCount(0);
+ await page.goto("/dashboard/applications");
+ await expect(rowFor("Ubisoft")).toContainText("Decide on the offer");
+ await page.goto("/dashboard/career");
+ await expect(needsYou.getByText("Decide on the offer")).toBeVisible();
});
test("a failure outside every page shows the app's error screen, never the router's raw error", async ({