From aebeb3b0a951bd12cccb9e0b2fbd9a97ba258e47 Mon Sep 17 00:00:00 2001 From: Kacie Bawiec Date: Mon, 24 Feb 2020 14:46:23 -0800 Subject: [PATCH] Add Snapshot Rendering Test to ScrollView Summary: As title. Changelog: [Added] Add snapshot rendering test to ScrollView Reviewed By: zackargyle, TheSavior Differential Revision: D20037673 fbshipit-source-id: 4270bc63a6065789f072893756468b67deae169d --- .../ScrollView/__tests__/ScrollView-test.js | 36 ++++++++ .../__snapshots__/ScrollView-test.js.snap | 90 +++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 Libraries/Components/ScrollView/__tests__/ScrollView-test.js create mode 100644 Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap diff --git a/Libraries/Components/ScrollView/__tests__/ScrollView-test.js b/Libraries/Components/ScrollView/__tests__/ScrollView-test.js new file mode 100644 index 00000000000..5f048f7b334 --- /dev/null +++ b/Libraries/Components/ScrollView/__tests__/ScrollView-test.js @@ -0,0 +1,36 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @emails oncall+react_native + * @flow strict-local + */ + +'use strict'; + +const React = require('react'); +const ScrollView = require('../ScrollView'); +const ReactNativeTestTools = require('../../../Utilities/ReactNativeTestTools'); +const View = require('../../View/View'); +const Text = require('../../../Text/Text'); + +describe('', () => { + it('should render as expected', () => { + ReactNativeTestTools.expectRendersMatchingSnapshot( + 'ScrollView', + () => ( + + + Hello World! + + + ), + () => { + jest.dontMock('../ScrollView'); + }, + ); + }); +}); diff --git a/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap b/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap new file mode 100644 index 00000000000..7de0741031a --- /dev/null +++ b/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` + + + + + Hello World! + + + + +`; + +exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` + + + + + Hello World! + + + + +`; + +exports[` should render as expected: should shallow render as when mocked 1`] = ` + + + + Hello World! + + + +`; + +exports[` should render as expected: should shallow render as when not mocked 1`] = ` + + + + Hello World! + + + +`;