A full-featured CRM built with React, shadcn/ui, and Supabase.
Fix task list filter i18n test
Anibal Svarcasd8ce90bf3e28
diff --git a/src/components/atomic-crm/tasks/TasksListFilter.spec.tsx b/src/components/atomic-crm/tasks/TasksListFilter.spec.tsxindex 23a0d26a..a9c72c45 100644--- a/src/components/atomic-crm/tasks/TasksListFilter.spec.tsx+++ b/src/components/atomic-crm/tasks/TasksListFilter.spec.tsx@@ -22,8 +22,15 @@ const Wrapper = ({ children }: { children: React.ReactNode }) => (<CoreAdminContextdataProvider={fakeDataProvider({ tasks: [], contacts: [], sales: [] })}i18nProvider={{- translate: (key, options) =>- typeof options?._ === "string" ? options._ : key,+ translate: (key, options) => {+ if (typeof options?._ === "string") {+ return options._;+ }+ if (key === "crm.common.load_more") {+ return "Load more";+ }+ return key;+ },changeLocale: () => Promise.resolve(),getLocale: () => "en",}}@@ -77,21 +84,19 @@ describe("TaskListFilter", () => {it("Load more increases visible page size", async () => {const tasks = Array.from({ length: 8 }, (_, i) => createTask(i + 1, today));- const screen = await render(+ const { container, getByText } = await render(<TaskListFilter tasks={tasks} title="Today" isMobile={false} />,{wrapper: Wrapper,},);- expect(screen.getByText(/Task \d+/)).toHaveLength(5);- const loadMore = screen.getByText("Load more");+ expect(container.textContent?.match(/Task \d+/g) ?? []).toHaveLength(5);+ const loadMore = getByText("Load more");await loadMore.click();- // check the number of rendered tasks after clicking Load more- await expect(screen.getByText(/Task \d+/)).toHaveLength(8);- // After clicking, all 8 tasks fit in one page (5 + 10 = 15), so Load more disappears- await expect.element(screen.getByText("Load more")).not.toBeInTheDocument();+ expect(container.textContent?.match(/Task \d+/g) ?? []).toHaveLength(8);+ expect(container.textContent).not.toContain("Load more");});});