From 462352e609102d137df1ce45220cd5b54d9b3bd4 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Tue, 21 Mar 2017 22:18:57 -0700 Subject: [PATCH] add jest snapshot tests Reviewed By: yungsters Differential Revision: D4726519 fbshipit-source-id: 1ae98743cdb89acb2708d84073527015dbeee906 --- .../Lists/__tests__/FlatList-test.js | 64 ++++ .../Lists/__tests__/SectionList-test.js | 67 +++++ .../__snapshots__/FlatList-test.js.snap | 247 +++++++++++++++ .../__snapshots__/SectionList-test.js.snap | 281 ++++++++++++++++++ 4 files changed, 659 insertions(+) create mode 100644 Libraries/CustomComponents/Lists/__tests__/FlatList-test.js create mode 100644 Libraries/CustomComponents/Lists/__tests__/SectionList-test.js create mode 100644 Libraries/CustomComponents/Lists/__tests__/__snapshots__/FlatList-test.js.snap create mode 100644 Libraries/CustomComponents/Lists/__tests__/__snapshots__/SectionList-test.js.snap diff --git a/Libraries/CustomComponents/Lists/__tests__/FlatList-test.js b/Libraries/CustomComponents/Lists/__tests__/FlatList-test.js new file mode 100644 index 000000000..945e5f64e --- /dev/null +++ b/Libraries/CustomComponents/Lists/__tests__/FlatList-test.js @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ +'use strict'; + +jest.disableAutomock(); + +const React = require('React'); +const ReactTestRenderer = require('react-test-renderer'); + +const FlatList = require('FlatList'); + +describe('FlatList', () => { + it('renders simple list', () => { + const component = ReactTestRenderer.create( + } + /> + ); + expect(component).toMatchSnapshot(); + }); + it('renders empty list', () => { + const component = ReactTestRenderer.create( + } + /> + ); + expect(component).toMatchSnapshot(); + }); + it('renders null list', () => { + const component = ReactTestRenderer.create( + } + /> + ); + expect(component).toMatchSnapshot(); + }); + it('renders all the bells and whistles', () => { + const component = ReactTestRenderer.create( + } + ListFooterComponent={() =>