Skip to content

Commit 3e8e30f

Browse files
Jeremias Santosclaude
authored andcommitted
fix(pav-55): atualizar testes do jobsService para incluir credentials: include
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 38a3432 commit 3e8e30f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

frontend/tests/unit/utils/jobsService.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("jobsService", () => {
2323
vi.stubGlobal("fetch", fetchMock);
2424

2525
await fetchJobFiles();
26-
expect(fetchMock).toHaveBeenCalledWith("https://jobsglobalscraper.ddns.net/api/jobs/files");
26+
expect(fetchMock).toHaveBeenCalledWith("https://jobsglobalscraper.ddns.net/api/jobs/files", { credentials: "include" });
2727
});
2828

2929
it("filtra entradas invalidas ao listar arquivos", async () => {
@@ -68,7 +68,7 @@ describe("jobsService", () => {
6868
const response = await fetchJobsByFile("vagas.xlsx");
6969
expect(response.total).toBe(1);
7070
expect(response.file).toBe("vagas.xlsx");
71-
expect(fetchMock).toHaveBeenCalledWith("/api/jobs?file=vagas.xlsx");
71+
expect(fetchMock).toHaveBeenCalledWith("/api/jobs?file=vagas.xlsx", { credentials: "include" });
7272
});
7373

7474
it("usa endpoint sem sufixo quando fileName vazio", async () => {
@@ -81,7 +81,7 @@ describe("jobsService", () => {
8181
);
8282

8383
await fetchJobsByFile("");
84-
expect(fetch).toHaveBeenCalledWith("/api/jobs");
84+
expect(fetch).toHaveBeenCalledWith("/api/jobs", { credentials: "include" });
8585
});
8686

8787
it("normaliza payload invalido ao buscar jobs", async () => {
@@ -92,7 +92,7 @@ describe("jobsService", () => {
9292

9393
const response = await fetchJobsByFile("vagas com espaco.xlsx");
9494
expect(response).toEqual({ jobs: [], file: "", modifiedAt: null, total: 0 });
95-
expect(fetch).toHaveBeenCalledWith("/api/jobs?file=vagas%20com%20espaco.xlsx");
95+
expect(fetch).toHaveBeenCalledWith("/api/jobs?file=vagas%20com%20espaco.xlsx", { credentials: "include" });
9696
});
9797

9898
it("lanca erro com mensagem da API ao buscar jobs", async () => {
@@ -173,6 +173,7 @@ describe("jobsService", () => {
173173
method: "POST",
174174
headers: { "Content-Type": "application/json" },
175175
body: JSON.stringify({ keywords: ["node", "vitest"] }),
176+
credentials: "include",
176177
});
177178
});
178179

0 commit comments

Comments
 (0)