Skip to content

Commit

Permalink
removed create app render
Browse files Browse the repository at this point in the history
  • Loading branch information
adcoelho committed Nov 20, 2024
1 parent 07f311e commit e339380
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@
*/

import React from 'react';
import { screen, within, waitFor } from '@testing-library/react';
import { screen, within, waitFor, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SyncAlertsToggle } from './sync_alerts_toggle';
import { schema } from '../create/schema';
import { FormTestComponent } from '../../common/test_utils';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';

// Failing: https://github.com/elastic/kibana/issues/190270
describe.skip('SyncAlertsToggle', () => {
let appMockRender: AppMockRenderer;
describe('SyncAlertsToggle', () => {
const onSubmit = jest.fn();
const defaultFormProps = {
onSubmit,
Expand All @@ -28,15 +24,10 @@ describe.skip('SyncAlertsToggle', () => {

beforeEach(() => {
jest.clearAllMocks();
appMockRender = createAppMockRenderer();
});

afterEach(async () => {
await appMockRender.clearQueryCache();
});

it('it renders', async () => {
appMockRender.render(
render(
<FormTestComponent>
<SyncAlertsToggle isLoading={false} />
</FormTestComponent>
Expand All @@ -48,7 +39,7 @@ describe.skip('SyncAlertsToggle', () => {
});

it('it toggles the switch', async () => {
appMockRender.render(
render(
<FormTestComponent>
<SyncAlertsToggle isLoading={false} />
</FormTestComponent>
Expand All @@ -63,7 +54,7 @@ describe.skip('SyncAlertsToggle', () => {
});

it('calls onSubmit with correct data', async () => {
appMockRender.render(
render(
<FormTestComponent {...defaultFormProps}>
<SyncAlertsToggle isLoading={false} />
</FormTestComponent>
Expand All @@ -73,7 +64,7 @@ describe.skip('SyncAlertsToggle', () => {

await userEvent.click(within(synAlerts).getByRole('switch'));

await userEvent.click(screen.getByText('Submit'));
await userEvent.click(await screen.findByText('Submit'));

await waitFor(() => {
expect(onSubmit).toBeCalledWith(
Expand Down

0 comments on commit e339380

Please sign in to comment.