From 0473c27e3943874b984ed5f8460229c90bb2966b Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 24 Mar 2019 19:46:58 -0400 Subject: [PATCH] Updating Render to use react-testing-library --- .../Render/__snapshots__/test.js.snap | 601 ++++++++++++++---- src/components/Render/test.js | 25 +- 2 files changed, 497 insertions(+), 129 deletions(-) diff --git a/src/components/Render/__snapshots__/test.js.snap b/src/components/Render/__snapshots__/test.js.snap index c93ee1c..72014fb 100644 --- a/src/components/Render/__snapshots__/test.js.snap +++ b/src/components/Render/__snapshots__/test.js.snap @@ -1,155 +1,510 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Render debugging 1`] = ` -
- +
- - Example - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Example + + + + + + +
+ `; exports[`Render types Box 1`] = ` -
- +
- - - Example - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Example + + + + +
+ `; exports[`Render types HorizontalLayout 1`] = ` -
- +
- - - Example - - - Another Example - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Example + + + Another Example + + + + +
+ `; exports[`Render types Loop 1`] = ` -
- +
- - - Example - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Example + + + + +
+ `; exports[`Render types Pin 1`] = ` -
- +
- - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ `; exports[`Render types Text 1`] = ` -
- +
- - Example - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Example + + + +
+ `; exports[`Render types VerticalLayout 1`] = ` -
- +
- - - Example - - - Another Example - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Example + + + Another Example + + + + +
+ `; diff --git a/src/components/Render/test.js b/src/components/Render/test.js index 1f5bacc..9cb4f54 100644 --- a/src/components/Render/test.js +++ b/src/components/Render/test.js @@ -1,20 +1,33 @@ +jest.mock('rendering/Box', () => + require('__mocks__/component-mock')('rendering/Box')); +jest.mock('rendering/HorizontalLayout', () => + require('__mocks__/component-mock')('rendering/HorizontalLayout')); +jest.mock('rendering/Loop', () => + require('__mocks__/component-mock')('rendering/Loop')); +jest.mock('rendering/Pin', () => + require('__mocks__/component-mock')('rendering/Pin')); +jest.mock('rendering/Text', () => + require('__mocks__/component-mock')('rendering/Text')); +jest.mock('rendering/VerticalLayout', () => + require('__mocks__/component-mock')('rendering/VerticalLayout')); + import React from 'react'; import { render } from 'react-testing-library'; import Render from 'components/Render'; const testType = (name, item) => { - test.skip(name, () => { + test(name, () => { const data = { type: 'SVG', children: [item] }; - const component = shallow( + const { asFragment } = render( ); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); }; describe('Render', () => { - test.skip('debugging', () => { + test('debugging', () => { const data = { type: 'SVG', children: [ @@ -34,10 +47,10 @@ describe('Render', () => { } ] }; - const component = shallow( + const { asFragment } = render( ); - expect(component).toMatchSnapshot(); + expect(asFragment()).toMatchSnapshot(); }); describe('types', () => {