import * as React from 'react';
import { render } from 'react-testing-library';
import Accordion from './Accordion';
import { Consumer, Provider } from './ItemContext';

describe('ItemContext', () => {
    it('renders children props', () => {
        const { getByText } = render(
            <Accordion>
                <Provider uuid="FOO">
                    <Consumer>{(): string => 'Hello World'}</Consumer>
                </Provider>
            </Accordion>,
        );

        expect(getByText('Hello World')).toBeTruthy();
    });
});

import { mount } from 'enzyme';
import * as React from 'react';
import { Consumer, Provider } from './ItemContext';

describe('ItemContext', () => {
    it('Propagates uuid by context', () => {
        const mock = jest.fn(() => null);
        const uuid = 'foo';

        mount(
            <Provider uuid={uuid}>
                <Consumer>{mock}</Consumer>
            </Provider>,
        ).instance();

        expect(mock).toHaveBeenCalledWith(
            expect.objectContaining({
                uuid,
            }),
        );
    });

    it('renders Provider without children', () => {
        expect(() => mount(<Provider uuid="foo" />)).not.toThrow();
    });
});

--- 
+++ 
@@ -1,26 +1,18 @@
-import { mount } from 'enzyme';
 import * as React from 'react';
+import { render } from 'react-testing-library';
+import Accordion from './Accordion';
 import { Consumer, Provider } from './ItemContext';
 
 describe('ItemContext', () => {
-    it('Propagates uuid by context', () => {
-        const mock = jest.fn(() => null);
-        const uuid = 'foo';
+    it('renders children props', () => {
+        const { getByText } = render(
+            <Accordion>
+                <Provider uuid="FOO">
+                    <Consumer>{(): string => 'Hello World'}</Consumer>
+                </Provider>
+            </Accordion>,
+        );
 
-        mount(
-            <Provider uuid={uuid}>
-                <Consumer>{mock}</Consumer>
-            </Provider>,
-        ).instance();
-
-        expect(mock).toHaveBeenCalledWith(
-            expect.objectContaining({
-                uuid,
-            }),
-        );
-    });
-
-    it('renders Provider without children', () => {
-        expect(() => mount(<Provider uuid="foo" />)).not.toThrow();
+        expect(getByText('Hello World')).toBeTruthy();
     });
 });
Remove implementation details from ItemContext tests
