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: cover tag filtering and offscreen letter previews (RX-208)

Amruth Pillai37551f819fc9
diff --git a/apps/web/src/features/applications/components/list-view.test.tsx b/apps/web/src/features/applications/components/list-view.test.tsx
index da76e6c1c..85c709a54 100644
--- a/apps/web/src/features/applications/components/list-view.test.tsx
+++ b/apps/web/src/features/applications/components/list-view.test.tsx
@@ -208,7 +208,7 @@ it("selects a row without opening it", () => {
expect(checkbox.getAttribute("aria-checked")).toBe("true");
});
-it("filters by a tag chip without opening the row", () => {
+it("passes a tag chip selection to onTagSelect without opening the row", () => {
const onOpen = vi.fn();
const onTagSelect = vi.fn();
renderList([application({ tags: ["remote", "design"] })], "desktop", onOpen, onTagSelect);
diff --git a/apps/web/src/features/documents/document-card.test.tsx b/apps/web/src/features/documents/document-card.test.tsx
index f114e74e6..02861ad24 100644
--- a/apps/web/src/features/documents/document-card.test.tsx
+++ b/apps/web/src/features/documents/document-card.test.tsx
@@ -8,10 +8,11 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { DocumentCard } from "./document-card";
const letters = vi.hoisted(() => ({ load: vi.fn() }));
+const viewing = vi.hoisted(() => ({ inView: true }));
vi.mock("motion/react", async (importOriginal) => ({
...(await importOriginal<typeof import("motion/react")>()),
- useInView: () => true,
+ useInView: () => viewing.inView,
}));
vi.mock("@tanstack/react-router", () => ({
Link: ({ children, ...props }: React.ComponentProps<"a">) => (
@@ -54,7 +55,8 @@ const letter = (editedAt: Date): DocumentSummary =>
application: null,
}) as DocumentSummary;
-function renderCard(document: DocumentSummary) {
+function renderCard(document: DocumentSummary, { inView = true }: { inView?: boolean } = {}) {
+ viewing.inView = inView;
i18n.load("en", {});
i18n.activate("en");
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
@@ -110,6 +112,13 @@ it("shows a failed preview instead of an endless loading placeholder", async ()
expect(await screen.findByText("Preview unavailable")).toBeTruthy();
});
+it("does not fetch letter content while the card is offscreen", () => {
+ letters.load.mockClear();
+ renderCard(letter(new Date("2026-10-19T00:00:00.000Z")), { inView: false });
+
+ expect(letters.load).not.toHaveBeenCalled();
+});
+
it("fetches a new preview after the letter's content edit", async () => {
letters.load.mockResolvedValue({ greeting: null, content: "<p>First version.</p>" });
const view = renderCard(letter(new Date("2026-10-19T00:00:00.000Z")));
diff --git a/tests/e2e/specs/applications-tags.spec.ts b/tests/e2e/specs/applications-tags.spec.ts
new file mode 100644
index 000000000..23ae77a65
--- /dev/null
+++ b/tests/e2e/specs/applications-tags.spec.ts
@@ -0,0 +1,21 @@
+import type { Page } from "@playwright/test";
+import { expect, test } from "../fixtures/test";
+
+async function importApplications(page: Page, items: Record<string, unknown>[]) {
+ const response = await page.request.post("/api/openapi/applications/import", { data: { items } });
+ await expect(response).toBeOK();
+}
+
+test("a tag chip filters the application rows through the page search", async ({ authPage: page }) => {
+ await importApplications(page, [
+ { company: "Northwind Labs", role: "Engineer", status: "applied", tags: ["review-next"] },
+ { company: "Harborlight Studio", role: "Designer", status: "applied", tags: ["design"] },
+ ]);
+ await page.goto("/dashboard/applications");
+
+ await page.getByRole("button", { name: "Filter by review-next", exact: true }).click();
+
+ await expect(page.getByRole("searchbox", { name: "Search applications" })).toHaveValue("review-next");
+ await expect(page.getByRole("button", { name: /Engineer/ }).first()).toBeVisible();
+ await expect(page.getByRole("button", { name: /Designer/ })).toHaveCount(0);
+});