12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import {initializeOrg} from 'sentry-test/initializeOrg';
- import {render, screen, waitFor} from 'sentry-test/reactTestingLibrary';
- import ProjectPlugins from 'sentry/views/settings/projectPlugins/projectPlugins';
- describe('ProjectPlugins', function () {
- it('renders', async function () {
- const {organization, routerProps, project} = initializeOrg();
- const {container} = render(
- <ProjectPlugins
- {...routerProps}
- organization={organization}
- params={{
- orgId: organization.slug,
- }}
- project={project}
- onChange={jest.fn()}
- loading={false}
- error={undefined}
- plugins={TestStubs.Plugins()}
- />
- );
- await waitFor(() =>
- expect(screen.queryByTestId('loading-indicator')).not.toBeInTheDocument()
- );
- expect(container).toSnapshot();
- });
- it('has error state when plugins=[]', async function () {
- const {organization, routerProps, project} = initializeOrg();
- render(
- <ProjectPlugins
- {...routerProps}
- organization={organization}
- params={{
- orgId: organization.slug,
- }}
- project={project}
- onChange={jest.fn()}
- loading={false}
- error={new Error('An error')}
- plugins={[]}
- />
- );
- expect(await screen.findByText('Oops! Something went wrong')).toBeInTheDocument();
- });
- });
|