diff --git a/src/app.test.js b/src/app.test.js index 4e67a4ac..95cc1e08 100644 --- a/src/app.test.js +++ b/src/app.test.js @@ -25,7 +25,7 @@ describe('Application', () => { const urlTitles = { '/': 'Landing page', '/s': 'Search page', - '/l/listing-title-slug/1234': 'Banyan Studios 55€ / day', + '/l/listing-title-slug/1234': 'Loading listing data', '/u/1234': 'Profile page with display name: 1234', '/checkout/1234': 'Book Banyan Studios (1234)', '/login': 'Authentication page: login tab', diff --git a/src/containers/ListingPage/ListingPage.test.js b/src/containers/ListingPage/ListingPage.test.js index 9b7c1e52..e9b334b3 100644 --- a/src/containers/ListingPage/ListingPage.test.js +++ b/src/containers/ListingPage/ListingPage.test.js @@ -1,10 +1,19 @@ import React from 'react'; -import { renderShallow } from '../../util/test-helpers'; -import ListingPage from './ListingPage'; +import { createListing } from '../../util/test-data'; +import { fakeIntl, renderShallow } from '../../util/test-helpers'; +import { ListingPageComponent } from './ListingPage'; describe('ListingPage', () => { it('matches snapshot', () => { - const tree = renderShallow(); + const entitiesData = { entities: { listing: { listing1: createListing('listing1') } } }; + const tree = renderShallow( + l} + />, + ); expect(tree).toMatchSnapshot(); }); }); diff --git a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap index f70e5731..8601c5e5 100644 --- a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap +++ b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap @@ -1,6 +1,6 @@ exports[`ListingPage matches snapshot 1`] = ` + title="listing1 title 55€ / day">
img1 - Organic Music Production in a Sustainable, Ethical and Professional Studio. -

-

- Social Permaculture focuses on nourishing our environment with abundance instead of depleting it. -

-

- Banyan Studios is a comfortable, conscious, inspiring and creative retreat for musicians trying to convey their message through state of the art Audio & Video. -

- https://vimeo.com/168106603 - ", + "__html": "listing1 description", } } />
@@ -129,7 +118,7 @@ exports[`ListingPage matches snapshot 1`] = ` "id": 12345, } }> - Book Banyan Studios + Book listing1 title `; diff --git a/src/util/test-helpers.js b/src/util/test-helpers.js index e2021dac..ef40478e 100644 --- a/src/util/test-helpers.js +++ b/src/util/test-helpers.js @@ -46,3 +46,15 @@ export const renderDeep = component => { ); return comp.toJSON(); }; + +// Create fake Internalization object to help with shallow rendering. +export const fakeIntl = { + formatDate: d => d, + formatHTMLMessage: d => d, + formatMessage: msg => msg.defaultMessage, + formatNumber: d => d, + formatPlural: d => d, + formatRelative: d => d, + formatTime: d => d, + now: d => d, +};