Skip to content

Commit

Permalink
Backport/backport 383 to 2.x units fix (#425)
Browse files Browse the repository at this point in the history
* unit tests fix

Signed-off-by: Jovan Cvetkovic <[email protected]>

* unit tests fix

Signed-off-by: Jovan Cvetkovic <[email protected]>

---------

Signed-off-by: Jovan Cvetkovic <[email protected]>
  • Loading branch information
jovancvetkovic3006 authored Feb 21, 2023
1 parent 55f5795 commit 280a981
Show file tree
Hide file tree
Showing 7 changed files with 1,537 additions and 4,063 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,28 @@
*/

import React from 'react';
import { render } from '@testing-library/react';
import props from '../../../../../test/mocks/Detectors/components/UpdateAlertConditions/UpdateAlertConditions.mock';
import { expect } from '@jest/globals';
import UpdateAlertConditions from './UpdateAlertConditions';
import { act } from 'react-dom/test-utils';
import { mount } from 'enzyme';
import { contextServicesMock } from '../../../../../test/mocks/useContext.mock';

jest.mock(
'../../../CreateDetector/components/ConfigureAlerts/containers/ConfigureAlerts.tsx',
() => () => {
return <mock-component mock="ConfigureAlerts" />;
}
);

describe('<UpdateAlertConditions /> spec', () => {
it('renders the component', () => {
const view = render(<UpdateAlertConditions {...props} />);
expect(view).toMatchSnapshot();
it('renders the component', async () => {
let wrapper;
await act(async () => {
UpdateAlertConditions.contextType = React.createContext(contextServicesMock);
wrapper = await mount(<UpdateAlertConditions {...props} />);
});
wrapper.update();
expect(wrapper).toMatchSnapshot();
});
});
Loading

0 comments on commit 280a981

Please sign in to comment.