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
This commit is contained in:
committed by
Facebook Github Bot
parent
03dd7a5981
commit
36abf6e38c
44
src/chrome/__tests__/ShareSheetPendingDialog.node.tsx
Normal file
44
src/chrome/__tests__/ShareSheetPendingDialog.node.tsx
Normal file
@@ -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 = (
|
||||||
|
<Provider store={mockStore}>
|
||||||
|
<ShareSheetPendingDialog
|
||||||
|
onCancel={() => {}}
|
||||||
|
onRunInBackground={() => {}}
|
||||||
|
statusMessage="wubba lubba dub dub"
|
||||||
|
statusUpdate="Update"
|
||||||
|
/>
|
||||||
|
</Provider>
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(renderer.create(component).toJSON()).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ShareSheetPendingDialog is rendered without status update', () => {
|
||||||
|
const component = (
|
||||||
|
<Provider store={mockStore}>
|
||||||
|
<ShareSheetPendingDialog
|
||||||
|
onCancel={() => {}}
|
||||||
|
onRunInBackground={() => {}}
|
||||||
|
statusMessage="wubba lubba dub dub"
|
||||||
|
statusUpdate={null}
|
||||||
|
/>
|
||||||
|
</Provider>
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(renderer.create(component).toJSON()).toMatchSnapshot();
|
||||||
|
});
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`ShareSheetPendingDialog is rendered with status update 1`] = `
|
||||||
|
<div
|
||||||
|
className="css-1uu1nb5"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="css-mgujkx"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="css-1hed33k"
|
||||||
|
size={30}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="css-18qh9b2"
|
||||||
|
color="#6f6f6f"
|
||||||
|
>
|
||||||
|
Update
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="css-a1glw"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="css-12zzrdt"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="css-1awwm1c"
|
||||||
|
onClick={[Function]}
|
||||||
|
onMouseDown={[Function]}
|
||||||
|
onMouseUp={[Function]}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="css-1awwm1c"
|
||||||
|
onClick={[Function]}
|
||||||
|
onMouseDown={[Function]}
|
||||||
|
onMouseUp={[Function]}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
Run In Background
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`ShareSheetPendingDialog is rendered without status update 1`] = `
|
||||||
|
<div
|
||||||
|
className="css-1uu1nb5"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="css-mgujkx"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="css-1hed33k"
|
||||||
|
size={30}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="css-18qh9b2"
|
||||||
|
color="#6f6f6f"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="css-a1glw"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="css-12zzrdt"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="css-1awwm1c"
|
||||||
|
onClick={[Function]}
|
||||||
|
onMouseDown={[Function]}
|
||||||
|
onMouseUp={[Function]}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="css-1awwm1c"
|
||||||
|
onClick={[Function]}
|
||||||
|
onMouseDown={[Function]}
|
||||||
|
onMouseUp={[Function]}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
Run In Background
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
Reference in New Issue
Block a user