Skip to content

Commit

Permalink
Merge pull request #126 from Arquisoft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
UO287741 authored Apr 29, 2024
2 parents aa99462 + b3c52b1 commit aeeee11
Showing 1 changed file with 8 additions and 1 deletion.
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();
});
});

});

0 comments on commit aeeee11

Please sign in to comment.