From 36abf6e38c35b07799f3fb84fcf2db4884b874fa Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Tue, 8 Oct 2019 00:17:23 -0700 Subject: [PATCH] Add tests for pending dialog Summary: The benefits of having things nicely encapsulated. Not super sophisticated, but better than nothing. Reviewed By: jknoxville Differential Revision: D17786832 fbshipit-source-id: 0b321e8a4e56188b0eab86515bd777ed3e3e8cb7 --- .../ShareSheetPendingDialog.node.tsx | 44 +++++++++ .../ShareSheetPendingDialog.node.tsx.snap | 89 +++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 src/chrome/__tests__/ShareSheetPendingDialog.node.tsx create mode 100644 src/chrome/__tests__/__snapshots__/ShareSheetPendingDialog.node.tsx.snap diff --git a/src/chrome/__tests__/ShareSheetPendingDialog.node.tsx b/src/chrome/__tests__/ShareSheetPendingDialog.node.tsx new file mode 100644 index 000000000..88bab7c3b --- /dev/null +++ b/src/chrome/__tests__/ShareSheetPendingDialog.node.tsx @@ -0,0 +1,44 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ + +import ShareSheetPendingDialog from '../ShareSheetPendingDialog'; +import React from 'react'; +import renderer from 'react-test-renderer'; +import configureStore from 'redux-mock-store'; + +const mockStore = configureStore([])({application: {sessionId: 'mysession'}}); +import {Provider} from 'react-redux'; + +test('ShareSheetPendingDialog is rendered with status update', () => { + const component = ( + + {}} + onRunInBackground={() => {}} + statusMessage="wubba lubba dub dub" + statusUpdate="Update" + /> + + ); + + expect(renderer.create(component).toJSON()).toMatchSnapshot(); +}); + +test('ShareSheetPendingDialog is rendered without status update', () => { + const component = ( + + {}} + onRunInBackground={() => {}} + statusMessage="wubba lubba dub dub" + statusUpdate={null} + /> + + ); + + expect(renderer.create(component).toJSON()).toMatchSnapshot(); +}); diff --git a/src/chrome/__tests__/__snapshots__/ShareSheetPendingDialog.node.tsx.snap b/src/chrome/__tests__/__snapshots__/ShareSheetPendingDialog.node.tsx.snap new file mode 100644 index 000000000..58068813d --- /dev/null +++ b/src/chrome/__tests__/__snapshots__/ShareSheetPendingDialog.node.tsx.snap @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ShareSheetPendingDialog is rendered with status update 1`] = ` +
+
+
+ + Update + +
+
+
+
+ Cancel +
+
+ Run In Background +
+
+
+`; + +exports[`ShareSheetPendingDialog is rendered without status update 1`] = ` +
+
+
+ +
+
+
+
+ Cancel +
+
+ Run In Background +
+
+
+`;