Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
import {PluginFixture} from 'sentry-fixture/plugin';
import {PluginsFixture} from 'sentry-fixture/plugins';
import {ProjectFixture} from 'sentry-fixture/project';
import {RouteComponentPropsFixture} from 'sentry-fixture/routeComponentPropsFixture';
import {RouterFixture} from 'sentry-fixture/routerFixture';

import {render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary';

Expand All @@ -16,7 +16,6 @@ describe('ProjectPluginDetails', function () {
const project = ProjectFixture();
const plugins = PluginsFixture();
const plugin = PluginFixture();
const routerProps = RouteComponentPropsFixture();

beforeAll(function () {
jest.spyOn(console, 'info').mockImplementation(() => {});
Expand Down Expand Up @@ -51,37 +50,34 @@ describe('ProjectPluginDetails', function () {
});

it('renders', async function () {
const router = RouterFixture({
params: {projectId: project.slug, pluginId: plugin.id},
});
render(
<ProjectPluginDetailsContainer
{...routerProps}
organization={organization}
project={project}
params={{
projectId: project.slug,
pluginId: 'amazon-sqs',
}}
/>
<ProjectPluginDetailsContainer organization={organization} project={project} />,
{router}
);
expect(await screen.findByRole('heading', {name: 'Amazon SQS'})).toBeInTheDocument();
});

it('resets plugin', async function () {
jest.spyOn(indicators, 'addSuccessMessage');
const router = RouterFixture({
params: {projectId: project.slug, pluginId: plugin.id},
});

render(
<ProjectPluginDetails
{...routerProps}
organization={organization}
project={project}
plugins={{plugins}}
params={{
projectId: project.slug,
pluginId: 'amazon-sqs',
}}
/>
/>,
{router}
);

await userEvent.click(screen.getByRole('button', {name: 'Reset Configuration'}));
await userEvent.click(
await screen.findByRole('button', {name: 'Reset Configuration'})
);

await waitFor(() =>
expect(indicators.addSuccessMessage).toHaveBeenCalledWith('Plugin was reset')
Expand All @@ -90,20 +86,16 @@ describe('ProjectPluginDetails', function () {

it('enables/disables plugin', async function () {
jest.spyOn(indicators, 'addSuccessMessage');
const router = RouterFixture({
params: {projectId: project.slug, pluginId: plugin.id},
});

render(
<ProjectPluginDetailsContainer
{...routerProps}
organization={organization}
project={project}
params={{
projectId: project.slug,
pluginId: 'amazon-sqs',
}}
/>
<ProjectPluginDetailsContainer organization={organization} project={project} />,
{router}
);

await userEvent.click(screen.getByRole('button', {name: 'Enable Plugin'}));
await userEvent.click(await screen.findByRole('button', {name: 'Enable Plugin'}));

await waitFor(() =>
expect(indicators.addSuccessMessage).toHaveBeenCalledWith('Plugin was enabled')
Expand Down
Loading
Loading