From 8830fad923389e6b9e419da4bdd9dedbf2437c2d Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Thu, 31 Jan 2019 21:19:19 -0500 Subject: [PATCH] Tests for SVG rendering component --- src/rendering/SVG/__snapshots__/test.js.snap | 61 ++++++++++++++++++++ src/rendering/SVG/test.js | 29 ++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/rendering/SVG/__snapshots__/test.js.snap create mode 100644 src/rendering/SVG/test.js diff --git a/src/rendering/SVG/__snapshots__/test.js.snap b/src/rendering/SVG/__snapshots__/test.js.snap new file mode 100644 index 0000000..7c75ea9 --- /dev/null +++ b/src/rendering/SVG/__snapshots__/test.js.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SVG layout 1`] = ` +Object { + "box": Object { + "height": 40, + "width": 120, + }, + "children": Array [ + Object { + "box": Object { + "height": 20, + "width": 100, + }, + "type": "Text", + }, + ], + "props": Object { + "height": 40, + "width": 120, + }, + "type": "SVG", +} +`; + +exports[`SVG rendering 1`] = ` + + + + + + + + + +", + } + } + /> + + Content + + +`; diff --git a/src/rendering/SVG/test.js b/src/rendering/SVG/test.js new file mode 100644 index 0000000..a62c2e2 --- /dev/null +++ b/src/rendering/SVG/test.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import SVG, { layout } from 'rendering/SVG'; + +describe('SVG', () => { + test('rendering', () => { + const component = shallow( + Content + ); + expect(component).toMatchSnapshot(); + }); + + test('layout', () => { + const processed = layout({ + type: 'SVG', + children: [ + { + type: 'Text', + box: { + width: 100, + height: 20 + } + } + ] + }); + expect(processed).toMatchSnapshot(); + }); +});