Fix tests

This commit is contained in:
Kimmo Puputti 2018-02-27 12:03:00 +02:00
parent 179a50977a
commit 4c942dafd3
2 changed files with 148 additions and 2 deletions

View file

@ -3,6 +3,8 @@ import { renderShallow } from '../../util/test-helpers';
import { fakeIntl, createCurrentUser } from '../../util/test-data';
import { PayoutPreferencesPageComponent } from './PayoutPreferencesPage';
const noop = () => null;
describe('PayoutPreferencesPage', () => {
it('matches snapshot with Stripe not connected', () => {
const currentUser = createCurrentUser('stripe-not-connected', {
@ -13,6 +15,10 @@ describe('PayoutPreferencesPage', () => {
<PayoutPreferencesPageComponent
currentUser={currentUser}
scrollingDisabled={false}
fetchInProgress={false}
payoutDetailsSaved={false}
onPayoutDetailsFormChange={noop}
onPayoutDetailsFormSubmit={noop}
intl={fakeIntl}
/>
);
@ -25,6 +31,26 @@ describe('PayoutPreferencesPage', () => {
<PayoutPreferencesPageComponent
currentUser={currentUser}
scrollingDisabled={false}
fetchInProgress={false}
payoutDetailsSaved={false}
onPayoutDetailsFormChange={noop}
onPayoutDetailsFormSubmit={noop}
intl={fakeIntl}
/>
);
expect(tree).toMatchSnapshot();
});
it('matches snapshot with details submitted', () => {
const currentUser = createCurrentUser('stripe-connected');
expect(currentUser.attributes.stripeConnected).toEqual(true);
const tree = renderShallow(
<PayoutPreferencesPageComponent
currentUser={currentUser}
scrollingDisabled={false}
fetchInProgress={false}
payoutDetailsSaved={true}
onPayoutDetailsFormChange={noop}
onPayoutDetailsFormSubmit={noop}
intl={fakeIntl}
/>
);

View file

@ -73,8 +73,19 @@ exports[`PayoutPreferencesPage matches snapshot with Stripe connected 1`] = `
/>
</h1>
<p>
Stripe connected: yes
<FormattedMessage
id="PayoutPreferencesPage.stripeAlreadyConnected"
values={Object {}}
/>
</p>
<Connect(ReduxForm)
createStripeAccountError={null}
disabled={true}
inProgress={false}
onChange={[Function]}
onSubmit={[Function]}
ready={false}
/>
</div>
</LayoutWrapperMain>
<LayoutWrapperFooter
@ -160,8 +171,117 @@ exports[`PayoutPreferencesPage matches snapshot with Stripe not connected 1`] =
/>
</h1>
<p>
Stripe connected: false
<FormattedMessage
id="PayoutPreferencesPage.stripeNotConnected"
values={Object {}}
/>
</p>
<Connect(ReduxForm)
createStripeAccountError={null}
disabled={false}
inProgress={false}
onChange={[Function]}
onSubmit={[Function]}
ready={false}
/>
</div>
</LayoutWrapperMain>
<LayoutWrapperFooter
className={null}
rootClassName={null}
>
<InjectIntl(Footer) />
</LayoutWrapperFooter>
</LayoutSideNavigation>
</Page>
`;
exports[`PayoutPreferencesPage matches snapshot with details submitted 1`] = `
<Page
scrollingDisabled={false}
title="PayoutPreferencesPage.title"
>
<LayoutSideNavigation
className={null}
containerClassName={null}
rootClassName={null}
>
<LayoutWrapperTopbar
className={null}
rootClassName={null}
>
<withRouter(Connect(TopbarContainerComponent))
currentPage="PayoutPreferencesPage"
/>
<UserNav
className={null}
rootClassName={null}
selectedPageName="PayoutPreferencesPage"
/>
</LayoutWrapperTopbar>
<LayoutWrapperSideNav
className={null}
rootClassName={null}
tabs={
Array [
Object {
"linkProps": Object {
"name": "ContactDetailsPage",
},
"selected": false,
"text": <FormattedMessage
id="PayoutPreferencesPage.emailTabTitle"
values={Object {}}
/>,
},
Object {
"linkProps": Object {
"name": "PasswordChangePage",
},
"selected": false,
"text": <FormattedMessage
id="PayoutPreferencesPage.passwordTabTitle"
values={Object {}}
/>,
},
Object {
"linkProps": Object {
"name": "PayoutPreferencesPage",
},
"selected": true,
"text": <FormattedMessage
id="PayoutPreferencesPage.paymentsTabTitle"
values={Object {}}
/>,
},
]
}
/>
<LayoutWrapperMain
className={null}
rootClassName={null}
>
<div>
<h1>
<FormattedMessage
id="PayoutPreferencesPage.heading"
values={Object {}}
/>
</h1>
<p>
<FormattedMessage
id="PayoutPreferencesPage.payoutDetailsSaved"
values={Object {}}
/>
</p>
<Connect(ReduxForm)
createStripeAccountError={null}
disabled={true}
inProgress={false}
onChange={[Function]}
onSubmit={[Function]}
ready={true}
/>
</div>
</LayoutWrapperMain>
<LayoutWrapperFooter