Skip to content

Commit

Permalink
fix(metadata-editor): Remove unnecessary mock
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubKida authored and jankowiakdawid committed Sep 26, 2024
1 parent d78aa0f commit 860a8bb
Showing 1 changed file with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,6 @@ describe('MetadataInstanceEditor', () => {
onUnsavedChangesModalCancel: mockOnUnsavedChangesModalCancel,
};

// Mock window.matchMedia to simulate media query behavior for tests
// in which UnsavedChangesModal component relies on it.
const mockMatchMedia = () =>
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation(query => ({
matches: false,
media: query,
onchange: null,
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});

test('should render MetadataInstanceForm with correct props', () => {
render(<MetadataInstanceEditor {...defaultProps} />);

Expand All @@ -90,8 +75,6 @@ describe('MetadataInstanceEditor', () => {
});

test('should render UnsavedChangesModal if isUnsavedChangesModalOpen is true', async () => {
mockMatchMedia();

const props = { ...defaultProps, isUnsavedChangesModalOpen: true };
const { findByText } = render(<MetadataInstanceEditor {...props} />);

Expand All @@ -110,8 +93,6 @@ describe('MetadataInstanceEditor', () => {
});

test('Should call onUnsavedChangesModalCancel instead onCancel when canceling through UnsavedChangesModal', async () => {
mockMatchMedia();

const props: MetadataInstanceEditorProps = {
...defaultProps,
template: mockCustomMetadataTemplateWithField,
Expand Down

0 comments on commit 860a8bb

Please sign in to comment.