Skip to content

Commit 7989b9f

Browse files
committed
limpando código
1 parent 3bbf5e5 commit 7989b9f

File tree

28 files changed

+18
-93
lines changed

28 files changed

+18
-93
lines changed

frontend/src/API/Auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import api from './api'; // Importa a instância que criamos no Passo 2
1+
import api from './api';
22
import { isAxiosError } from 'axios';
33

44
export interface LoginProps {

frontend/src/API/AuthContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const AuthProvider: React.FC<{ children: ReactNode }> = ({ children }) =>
4646

4747
// Função de login que atualiza o estado E o localStorage
4848
const login = async (data: LoginProps) => {
49-
const { user, token } = await api.Login(data); // Chama sua API
49+
const { user, token } = await api.Login(data);
5050
localStorage.setItem('token', token);
5151
localStorage.setItem('user', JSON.stringify(user));
5252
setCurrentUser(user);

frontend/src/API/Comment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import api from './api';
22
import { isAxiosError } from 'axios';
3+
34
export interface CommentProps {
45
projectTitle?: string;
56
commentID?: string;

frontend/src/API/Project.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ export interface ProjectProps {
1414
}
1515

1616
export function parseDate(dataString: string): Date {
17-
// Divide a string "20/11/2025" em partes
1817
const [dia, mes, ano] = dataString.split('/');
1918

20-
// Cria a data: new Date(ano, mês - 1, dia)
2119
return new Date(Number(ano), Number(mes) - 1, Number(dia));
2220
}
2321

frontend/src/App.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { render, screen } from '@testing-library/react';
22
import { describe, it, expect, vi } from 'vitest';
33
import App from './App';
44

5-
// --- Mocks ---
65
vi.mock('./Router', () => ({
76
Router: () => <div data-testid="app-router">Router Content</div>
87
}));

frontend/src/components/common/Keyword/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import * as S from './styles';
33

4-
// Props que o componente Keyword aceita
54
interface KeywordProps {
65
children: React.ReactNode;
76
onRemove: () => void;

frontend/src/components/common/Modal/Modal.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ describe('Componente Modal', () => {
8282
</Modal>
8383
);
8484

85-
// Clica no cartão do modal (conteúdo)
8685
fireEvent.click(screen.getByTestId('content'));
8786

88-
// A função de fechar NÃO deve ser chamada
8987
expect(handleClose).not.toHaveBeenCalled();
9088
});
9189
});

frontend/src/components/common/Toast/Toast.spec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ describe('Componente Toast', () => {
5050
// Verifica que ainda não foi chamado
5151
expect(handleClose).not.toHaveBeenCalled();
5252

53-
// Avança o tempo em 5000ms (5 segundos)
53+
// Avança o tempo em 5000ms
5454
act(() => {
5555
vi.advanceTimersByTime(5000);
5656
});
5757

58-
// Agora deve ter sido chamado
5958
expect(handleClose).toHaveBeenCalledTimes(1);
6059
});
6160

frontend/src/components/common/Toast/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ToastContainer, ToastMessage, CloseButton } from './styles';
44
interface ToastProps {
55
message: string;
66
type: 'success' | 'error';
7-
onClose: () => void; // Função para fechar o toast
7+
onClose: () => void;
88
}
99

1010
export interface NotificationState {

frontend/src/components/domain/Postcard/Postcard.spec.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { BrowserRouter } from 'react-router-dom';
55
import * as ProjectAPI from '../../../API/Project';
66
import * as CommentAPI from '../../../API/Comment';
77

8-
// --- Mocks ---
98

109
// Mock do hook useAuth
1110
vi.mock('../../../API/AuthContext', () => ({
@@ -102,7 +101,6 @@ describe('Componente Postcard', () => {
102101
it('NÃO deve navegar se clicar em um botão interativo dentro do card', () => {
103102
render(<BrowserRouter><Postcard post={mockPost as unknown as ProjectAPI.ProjectProps} showMenu={true} /></BrowserRouter>);
104103

105-
// Clica no botão de menu (que está dentro do wrapper)
106104
fireEvent.click(screen.getByTestId('menu-btn'));
107105

108106
// O menu deve abrir, mas a navegação NÃO deve ocorrer
@@ -126,7 +124,6 @@ describe('Componente Postcard', () => {
126124
fireEvent.click(screen.getByTestId('menu-btn'));
127125
fireEvent.click(screen.getByTestId('delete-post-btn'));
128126

129-
// Botão de confirmação no modal (segundo botão "Excluir" na tela)
130127
const modalButtons = screen.getAllByText('Excluir');
131128
fireEvent.click(modalButtons[modalButtons.length - 1]);
132129

@@ -158,7 +155,6 @@ describe('Componente Postcard', () => {
158155

159156
fireEvent.click(screen.getByTestId('delete-post-btn'));
160157

161-
// Confirmação no Modal (o último botão "Excluir" está no modal)
162158
const buttons = screen.getAllByText('Excluir');
163159
const confirmDeleteBtn = buttons[buttons.length - 1];
164160
fireEvent.click(confirmDeleteBtn);

0 commit comments

Comments
 (0)