pleroma/app/soapbox/features/ui/components/__tests__/cta-banner.test.tsx

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-05-10 03:17:01 -07:00
import React from 'react';
2023-01-15 10:48:10 -08:00
import { storeClosed, storeLoggedIn, storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
2022-05-10 03:17:01 -07:00
import { render, screen } from '../../../../jest/test-helpers';
import CtaBanner from '../cta-banner';
describe('<CtaBanner />', () => {
it('renders the banner', () => {
2023-01-15 10:48:10 -08:00
render(<CtaBanner />, undefined, storeOpen);
2022-05-10 03:17:01 -07:00
expect(screen.getByTestId('cta-banner')).toHaveTextContent(/sign up/i);
});
describe('with a logged in user', () => {
it('renders empty', () => {
2023-01-15 10:48:10 -08:00
render(<CtaBanner />, undefined, storeLoggedIn);
2022-05-10 03:17:01 -07:00
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
});
});
describe('with registrations closed', () => {
2022-05-10 03:17:01 -07:00
it('renders empty', () => {
2023-01-15 10:48:10 -08:00
render(<CtaBanner />, undefined, storeClosed);
2022-05-10 03:17:01 -07:00
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
});
});
describe('with Pepe enabled', () => {
it('renders the banner', () => {
2023-01-15 10:48:10 -08:00
render(<CtaBanner />, undefined, storePepeOpen);
expect(screen.getByTestId('cta-banner')).toHaveTextContent(/sign up/i);
});
});
2022-05-10 03:17:01 -07:00
});