generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from Arquisoft/fixFinalTest
Fix final test
- Loading branch information
Showing
2 changed files
with
74 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { render, fireEvent } from '@testing-library/react'; | ||
import { CreationModal } from './GroupCreationModal'; | ||
|
||
jest.mock('axios'); | ||
|
||
describe('CreationModal component', () => { | ||
test('renders the modal properly', async () => { | ||
const { getByTestId } = render(<CreationModal nowHasGroup={() => {}} setError={() => {}} toggleCreateModal={() => {}} />); | ||
|
||
// Verifica que el título del modal esté presente | ||
expect(getByTestId('modal-title')).toBeInTheDocument(); | ||
|
||
// Verifica que los elementos de entrada estén presentes | ||
expect(getByTestId('group-name-input')).toBeInTheDocument(); | ||
expect(getByTestId('yes-button')).toBeInTheDocument(); | ||
expect(getByTestId('no-button')).toBeInTheDocument(); | ||
expect(getByTestId('description-input')).toBeInTheDocument(); | ||
}); | ||
|
||
test('clicking on the create button calls the createGroup function', async () => { | ||
const mockNowHasGroup = jest.fn(); | ||
const mockSetError = jest.fn(); | ||
const mockToggleCreateModal = jest.fn(); | ||
|
||
const { getByTestId } = render(<CreationModal nowHasGroup={mockNowHasGroup} setError={mockSetError} toggleCreateModal={mockToggleCreateModal} />); | ||
|
||
// Simula hacer clic en el botón de creación | ||
fireEvent.click(getByTestId('create-button')); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters