diff --git a/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx b/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx index d179e6e9467..5ef5014bcd0 100644 --- a/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx +++ b/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx @@ -1,26 +1,32 @@ -import { CodeEditor, Language } from '../CodeEditor'; import React from 'react'; -import { shallow } from 'enzyme'; +import { render } from '@testing-library/react'; +import { CodeEditor, Language } from '../CodeEditor'; -test(`CodeEditor`, () => { - const view = shallow(); - expect(view).toMatchSnapshot(); -}); +describe('CodeEditor', () => { + beforeAll(() => { + window.HTMLCanvasElement.prototype.getContext = () => ({} as any); + }); + + test('matches snapshot without props', () => { + const view = render(); + expect(view.container).toMatchSnapshot(); + }); -test(`CodeEditor with all flags`, () => { - const view = shallow( - - ); - expect(view).toMatchSnapshot(); + test('matches snapshot with all props', () => { + const view = render( + + ); + expect(view.container).toMatchSnapshot(); + }); }); diff --git a/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap b/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap index 492ff8420cb..bc17554226f 100644 --- a/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap +++ b/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap @@ -1,31 +1,578 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`CodeEditor 1`] = ` - - - +exports[`CodeEditor matches snapshot with all props 1`] = ` +
+
+
+
+
+ + + +
+
+
+ + + + + JAVASCRIPT + +
+
+
+ +
+
+
+
+