Skip to content

Commit 8a7477a

Browse files
committed
feat(tests): fix testes
1 parent d62d44b commit 8a7477a

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

frontend/tests/unit/components/landing/TeamSection.test.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import { render, screen, waitFor } from "@testing-library/react";
23
import { afterEach, describe, expect, it, vi } from "vitest";
34

@@ -19,7 +20,7 @@ describe("TeamSection", () => {
1920
});
2021

2122
it("renderiza lista da API, filtra bots e garante presença do Pedro", async () => {
22-
vi.spyOn(global, "fetch").mockResolvedValue({
23+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
2324
ok: true,
2425
json: async () => [
2526
{
@@ -54,7 +55,7 @@ describe("TeamSection", () => {
5455
});
5556

5657
it("mantém fallback local quando API retorna resposta inválida", async () => {
57-
vi.spyOn(global, "fetch").mockResolvedValue({
58+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
5859
ok: true,
5960
json: async () => ({ invalid: true }),
6061
} as any);
@@ -68,7 +69,7 @@ describe("TeamSection", () => {
6869

6970
it("mantém fallback local e emite warning quando falha na API", async () => {
7071
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
71-
vi.spyOn(global, "fetch").mockRejectedValue(new Error("offline"));
72+
vi.spyOn(globalThis, "fetch").mockRejectedValue(new Error("offline"));
7273

7374
render(<TeamSection />);
7475

@@ -80,7 +81,7 @@ describe("TeamSection", () => {
8081
});
8182

8283
it("atualiza avatar de PedroLucas1337 quando vem da API com avatar incorreto", async () => {
83-
vi.spyOn(global, "fetch").mockResolvedValue({
84+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
8485
ok: true,
8586
json: async () => [
8687
{
@@ -106,7 +107,7 @@ describe("TeamSection", () => {
106107
});
107108

108109
it("trata erro HTTP com status nao ok", async () => {
109-
vi.spyOn(global, "fetch").mockResolvedValue({
110+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
110111
ok: false,
111112
status: 403,
112113
} as any);
@@ -120,7 +121,7 @@ describe("TeamSection", () => {
120121
});
121122

122123
it("exibe plural de commits corretamente", async () => {
123-
vi.spyOn(global, "fetch").mockResolvedValue({
124+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
124125
ok: true,
125126
json: async () => [
126127
{
@@ -142,7 +143,7 @@ describe("TeamSection", () => {
142143
});
143144

144145
it("exibe plural de commits quando > 1", async () => {
145-
vi.spyOn(global, "fetch").mockResolvedValue({
146+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
146147
ok: true,
147148
json: async () => [
148149
{
@@ -164,7 +165,7 @@ describe("TeamSection", () => {
164165
});
165166

166167
it("nao atualiza contributors quando lista vazia", async () => {
167-
vi.spyOn(global, "fetch").mockResolvedValue({
168+
vi.spyOn(globalThis, "fetch").mockResolvedValue({
168169
ok: true,
169170
json: async () => [],
170171
} as any);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
12
import { render, screen } from "@testing-library/react";
23
import { MemoryRouter } from "react-router-dom";
34
import { describe, expect, it, vi } from "vitest";

0 commit comments

Comments
 (0)