Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #126

Merged
merged 4 commits into from
Apr 29, 2024
Merged

Dev #126

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion webapp/src/components/group/NoGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { render, screen, fireEvent, waitFor,act } from '@testing-library/react';
import axios from 'axios'; // Mockear axios
import NoGroup from './NoGroup';

Expand Down Expand Up @@ -52,6 +52,12 @@ describe('NoGroup component', () => {
await waitFor(() => {
expect(screen.getByTestId('join-group-modal')).toBeInTheDocument();
});
// Simula la llamada a joinGroup
await act(async () => {
await fireEvent.click(screen.getByTestId(`join-group-button`));
});
// Simula una respuesta exitosa de la API
axios.post.mockResolvedValueOnce({});
});

test('clicking on "Create a group" button opens the create modal', async () => {
Expand All @@ -65,4 +71,5 @@ describe('NoGroup component', () => {
expect(screen.getByTestId('create-group-modal')).toBeInTheDocument();
});
});

});