mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Update tests
This commit is contained in:
parent
875e6de4ca
commit
47e1b36df2
4 changed files with 28 additions and 18 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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(<ListingPage params={{ slug: 'banyan-studios', id: 1234 }} />);
|
||||
const entitiesData = { entities: { listing: { listing1: createListing('listing1') } } };
|
||||
const tree = renderShallow(
|
||||
<ListingPageComponent
|
||||
params={{ slug: 'listing1-title', id: 'listing1' }}
|
||||
entitiesData={entitiesData}
|
||||
intl={fakeIntl}
|
||||
onLoadListing={l => l}
|
||||
/>,
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
exports[`ListingPage matches snapshot 1`] = `
|
||||
<Connect(withRouter(PageLayout))
|
||||
title="Banyan Studios 55€ / day">
|
||||
title="listing1 title 55€ / day">
|
||||
<div>
|
||||
<img
|
||||
alt="img1"
|
||||
|
|
@ -39,18 +39,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
<div
|
||||
dangerouslySetInnerHTML={
|
||||
Object {
|
||||
"__html": "
|
||||
<p>
|
||||
Organic Music Production in a Sustainable, Ethical and Professional Studio.
|
||||
</p>
|
||||
<p>
|
||||
Social Permaculture focuses on nourishing our environment with abundance instead of depleting it.
|
||||
</p>
|
||||
<p>
|
||||
Banyan Studios is a comfortable, conscious, inspiring and creative retreat for musicians trying to convey their message through state of the art Audio & Video.
|
||||
</p>
|
||||
<a href=\"https://vimeo.com/168106603\" alt=\"video\">https://vimeo.com/168106603</a>
|
||||
",
|
||||
"__html": "listing1 description",
|
||||
}
|
||||
} />
|
||||
<div>
|
||||
|
|
@ -129,7 +118,7 @@ exports[`ListingPage matches snapshot 1`] = `
|
|||
"id": 12345,
|
||||
}
|
||||
}>
|
||||
Book Banyan Studios
|
||||
Book listing1 title
|
||||
</withFlattenedRoutes(withRouter(NamedLink))>
|
||||
</Connect(withRouter(PageLayout))>
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue