From cb30675958ea2c3b7841cdd20236a2dd35530bf0 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Thu, 1 Jun 2017 17:28:00 +0300 Subject: [PATCH] Fix tests other components too (Avatar is used in several places). --- .../OrderDetailsPanel/OrderDetailsPanel.js | 2 +- .../OrderDetailsPanel.test.js.snap | 4 +++- .../SaleDetailsPanel/SaleDetailsPanel.js | 2 +- .../SaleDetailsPanel.test.js.snap | 4 +++- .../__snapshots__/TopbarDesktop.test.js.snap | 9 ++++++--- src/containers/InboxPage/InboxPage.js | 16 +++++++++------- .../__snapshots__/InboxPage.test.js.snap | 18 ++++++++++++------ src/containers/ListingPage/ListingPage.js | 2 +- .../__snapshots__/ListingPage.test.js.snap | 4 +++- 9 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/components/OrderDetailsPanel/OrderDetailsPanel.js b/src/components/OrderDetailsPanel/OrderDetailsPanel.js index 6e54635b..1c44202c 100644 --- a/src/components/OrderDetailsPanel/OrderDetailsPanel.js +++ b/src/components/OrderDetailsPanel/OrderDetailsPanel.js @@ -128,7 +128,7 @@ const OrderDetailsPanel = props => {

{stateMsgData.title}

- +
{stateMsgData.message}
diff --git a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap index ef0fac82..eb2ddd3c 100644 --- a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap +++ b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap @@ -23,7 +23,9 @@ exports[`OrderDetailsPanel matches snapshot 1`] = `
+ firstName="provider first name" + lastName="provider last name" + rootClassName={null} />
{
- +

{stateMsgData.title} diff --git a/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap b/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap index e35c4221..df115e10 100644 --- a/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap +++ b/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap @@ -5,7 +5,9 @@ exports[`SaleDetailsPanel matches snapshot 1`] = `
+ firstName="customer1 first name" + lastName="customer1 last name" + rootClassName={null} />

- John Doe + title=""> + + + +

{ - const profile = user && user.attributes && user.attributes.profile - ? user.attributes.profile - : null; - return profile ? `${profile.firstName} ${profile.lastName}` : ''; + const profile = user && user.attributes && user.attributes.profile ? user.attributes.profile : {}; + return { + firstName: profile.firstName, + lastName: profile.lastName, + name: profile.firstName ? `${profile.firstName} ${profile.lastName}` : '', + }; }; // Localised timestamp when the given transaction was updated @@ -63,7 +65,7 @@ export const InboxItem = props => { const { type, tx, intl } = props; const { customer, provider } = tx; const isOrder = type === 'order'; - const otherUserName = username(isOrder ? provider : customer); + const otherUser = username(isOrder ? provider : customer); const changedDate = timestamp(intl, tx); return ( { params={{ id: tx.id.uuid }} >
- +
- {otherUserName} + {otherUser.name} {changedDate.date}
{txState(intl, tx)}
diff --git a/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap b/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap index 959f29fb..e981a9c3 100644 --- a/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap +++ b/src/containers/InboxPage/__snapshots__/InboxPage.test.js.snap @@ -149,10 +149,13 @@ exports[`InboxPage matches snapshot 2`] = ` style={Object {}}>
- provider-user-id first name provider-user-id last name + title="provider-user-id first name provider-user-id last name"> + + pp + +
@@ -326,10 +329,13 @@ exports[`InboxPage matches snapshot 4`] = ` style={Object {}}>
- customer-user-id first name customer-user-id last name + title="customer-user-id first name customer-user-id last name"> + + cc + +
diff --git a/src/containers/ListingPage/ListingPage.js b/src/containers/ListingPage/ListingPage.js index 120bb337..fa6649e7 100644 --- a/src/containers/ListingPage/ListingPage.js +++ b/src/containers/ListingPage/ListingPage.js @@ -170,7 +170,7 @@ export class ListingPageComponent extends Component { const authorInfo = authorAvailable ?
- +
{authorName} diff --git a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap index 341e6583..6101b1fe 100644 --- a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap +++ b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap @@ -44,7 +44,9 @@ exports[`ListingPage matches snapshot 1`] = `
+ firstName="user-1 first name" + lastName="user-1 last name" + rootClassName={null} />