Skip to content

Commit

Permalink
Test fix Nav
Browse files Browse the repository at this point in the history
  • Loading branch information
UO287747 committed Feb 28, 2024
1 parent d7c9d28 commit 5315046
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions webapp/src/test/Nav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@ describe('Nav component', () => {
const mockGoTo = jest.fn();
render(<Nav goTo={mockGoTo} />);

// Verifica que los elementos del Nav se rendericen correctamente
expect(screen.getByText('Volver al Menú')).toBeInTheDocument();
expect(screen.getByAltText('Remy Sharp')).toBeInTheDocument();

// Simula hacer clic en el botón de menú
fireEvent.click(screen.getByLabelText('account of current user'));
// Verifica que se abra el menú
expect(screen.getByText('Profile')).toBeInTheDocument();
expect(screen.getByText('Logout')).toBeInTheDocument();

// Simula hacer clic en el botón de "Volver al Menú"
fireEvent.click(screen.getByText('Volver al Menú'));
// Verifica que la función goTo haya sido llamada con el parámetro correcto
expect(mockGoTo).toHaveBeenCalledWith(1);

// Simula hacer clic en el botón de "Logout"
fireEvent.click(screen.getByText('Logout'));
// Verifica que la función goTo haya sido llamada con el parámetro correcto
expect(mockGoTo).toHaveBeenCalledWith(0);

});
});

0 comments on commit 5315046

Please sign in to comment.