Files
ncd-fe/packages/pl-fe/src/modals/unauthorized-modal.test.tsx
Nicole Mikołajczyk e350c616b8 pl-fe: move more stuff around
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
2025-05-03 17:35:43 +02:00

26 lines
877 B
TypeScript

import React from 'react';
import { storeOpen } from 'pl-fe/jest/mock-stores';
import { render, screen } from 'pl-fe/jest/test-helpers';
import UnauthorizedModal from './unauthorized-modal';
describe('<UnauthorizedModal />', () => {
it('successfully renders', () => {
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />);
expect(screen.getByTestId('modal')).toBeInTheDocument();
});
it('doesn\'t display the signup button by default', () => {
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />);
expect(screen.queryByText('Sign up')).not.toBeInTheDocument();
});
describe('with registrations enabled', () => {
it('displays the signup button', () => {
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />, undefined, storeOpen);
expect(screen.getByText('Sign up')).toBeInTheDocument();
});
});
});