Skip to content

Commit 6fc96ee

Browse files
committed
fix: correção de testes
1 parent 58f2487 commit 6fc96ee

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

frontend/tests/unit/pages/App.test.tsx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "@testing-library/jest-dom";
12
import { act, render, screen } from "@testing-library/react";
23
import { MemoryRouter } from "react-router-dom";
34
import { describe, expect, it, vi } from "vitest";
@@ -11,7 +12,15 @@ vi.mock("@/hooks/useJobsData", () => ({
1112
files: [{ file: "vagas.xlsx" }],
1213
selectedFile: "vagas.xlsx",
1314
setSelectedFile: vi.fn(),
14-
jobs: [{ titulo: "Dev", empresa: "ACME", local: "BR", palavra: "React", link: "x" }],
15+
jobs: [
16+
{
17+
titulo: "Dev",
18+
empresa: "ACME",
19+
local: "BR",
20+
palavra: "React",
21+
link: "x",
22+
},
23+
],
1524
meta: { file: "vagas.xlsx", modifiedAt: 1, total: 1 },
1625
loading: false,
1726
scraping: false,
@@ -28,7 +37,15 @@ vi.mock("@/hooks/useJobsFiltering", () => ({
2837
keywordFilter: [],
2938
setKeywordFilter: vi.fn(),
3039
keywords: ["React"],
31-
filteredJobs: [{ titulo: "Dev", empresa: "ACME", local: "BR", palavra: "React", link: "x" }],
40+
filteredJobs: [
41+
{
42+
titulo: "Dev",
43+
empresa: "ACME",
44+
local: "BR",
45+
palavra: "React",
46+
link: "x",
47+
},
48+
],
3249
}),
3350
}));
3451

@@ -40,14 +57,22 @@ vi.mock("@/hooks/useJobsPagination", () => ({
4057
setPageSize: vi.fn(),
4158
resetPagination: vi.fn(),
4259
totalPages: 1,
43-
paginatedJobs: [{ titulo: "Dev", empresa: "ACME", local: "BR", palavra: "React", link: "x" }],
60+
paginatedJobs: [
61+
{
62+
titulo: "Dev",
63+
empresa: "ACME",
64+
local: "BR",
65+
palavra: "React",
66+
link: "x",
67+
},
68+
],
4469
}),
4570
}));
4671

4772
import App from "@/App";
4873

4974
describe("App", () => {
50-
it("renderiza painel principal", () => {
75+
it("renderiza a landing page após o loading", () => {
5176
vi.useFakeTimers();
5277

5378
try {
@@ -58,12 +83,14 @@ describe("App", () => {
5883
);
5984

6085
act(() => {
61-
vi.advanceTimersByTime(2000);
86+
vi.runAllTimers();
6287
});
6388

64-
expect(screen.getAllByAltText("Painel de Vagas").length).toBeGreaterThan(0);
89+
expect(
90+
screen.getAllByText(/funcionalidades/i).length
91+
).toBeGreaterThan(0);
6592
} finally {
6693
vi.useRealTimers();
6794
}
6895
});
69-
});
96+
});

0 commit comments

Comments
 (0)