soapbox/app/soapbox/features/ui/components/modals/__tests__/unauthorized-modal.test.tsx

33 wiersze
1.1 KiB
TypeScript
Czysty Zwykły widok Historia

import React from 'react';
2023-01-15 18:48:10 +00:00
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
import { render, screen } from 'soapbox/jest/test-helpers';
import UnauthorizedModal from '../unauthorized-modal';
describe('<UnauthorizedModal />', () => {
it('successfully renders', () => {
2023-09-16 20:16:59 +00:00
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />);
expect(screen.getByTestId('modal')).toBeInTheDocument();
});
it('doesn\'t display the signup button by default', () => {
2023-09-16 20:16:59 +00:00
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />);
expect(screen.queryByText('Sign up')).not.toBeInTheDocument();
});
describe('with registrations enabled', () => {
it('displays the signup button', () => {
2023-09-16 20:16:59 +00:00
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />, undefined, storeOpen);
expect(screen.getByText('Sign up')).toBeInTheDocument();
});
});
describe('with registrations closed, Pepe enabled', () => {
it('displays the signup button', () => {
2023-09-16 20:16:59 +00:00
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />, undefined, storePepeOpen);
expect(screen.getByText('Sign up')).toBeInTheDocument();
});
});
});