mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-31 02:26:50 +10:00
Merge pull request #330 from sharetribe/fix-sale-tests
Fix errors in Sale page tests
This commit is contained in:
commit
ad183a5340
5 changed files with 23 additions and 5 deletions
|
|
@ -257,7 +257,7 @@ SaleDetailsPanel.propTypes = {
|
||||||
transaction: propTypes.transaction.isRequired,
|
transaction: propTypes.transaction.isRequired,
|
||||||
onAcceptSale: func.isRequired,
|
onAcceptSale: func.isRequired,
|
||||||
onRejectSale: func.isRequired,
|
onRejectSale: func.isRequired,
|
||||||
acceptOrRejectInProgress: bool,
|
acceptOrRejectInProgress: bool.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SaleDetailsPanel;
|
export default SaleDetailsPanel;
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@ import { renderShallow } from '../../util/test-helpers';
|
||||||
import { BookingBreakdown } from '../../components';
|
import { BookingBreakdown } from '../../components';
|
||||||
import SaleDetailsPanel from './SaleDetailsPanel.js';
|
import SaleDetailsPanel from './SaleDetailsPanel.js';
|
||||||
|
|
||||||
|
const noop = () => null;
|
||||||
|
|
||||||
describe('SaleDetailsPanel', () => {
|
describe('SaleDetailsPanel', () => {
|
||||||
it('matches snapshot', () => {
|
it('matches snapshot', () => {
|
||||||
const { Money } = types;
|
const { Money } = types;
|
||||||
const tx = createTransaction({
|
const transaction = createTransaction({
|
||||||
id: 'sale-tx',
|
id: 'sale-tx',
|
||||||
state: 'state/preauthorized',
|
state: 'state/preauthorized',
|
||||||
total: new Money(16500, 'USD'),
|
total: new Money(16500, 'USD'),
|
||||||
|
|
@ -23,12 +25,18 @@ describe('SaleDetailsPanel', () => {
|
||||||
customer: createUser('customer1'),
|
customer: createUser('customer1'),
|
||||||
lastTransitionedAt: new Date(Date.UTC(2017, 5, 10)),
|
lastTransitionedAt: new Date(Date.UTC(2017, 5, 10)),
|
||||||
});
|
});
|
||||||
const tree = renderShallow(<SaleDetailsPanel transaction={tx} />);
|
const props = {
|
||||||
|
transaction,
|
||||||
|
onAcceptSale: noop,
|
||||||
|
onRejectSale: noop,
|
||||||
|
acceptOrRejectInProgress: false,
|
||||||
|
};
|
||||||
|
const tree = renderShallow(<SaleDetailsPanel {...props} />);
|
||||||
expect(tree).toMatchSnapshot();
|
expect(tree).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
it('renders correct total price', () => {
|
it('renders correct total price', () => {
|
||||||
const { Money } = types;
|
const { Money } = types;
|
||||||
const tx = createTransaction({
|
const transaction = createTransaction({
|
||||||
id: 'sale-tx',
|
id: 'sale-tx',
|
||||||
state: 'state/preauthorized',
|
state: 'state/preauthorized',
|
||||||
total: new Money(16500, 'USD'),
|
total: new Money(16500, 'USD'),
|
||||||
|
|
@ -42,7 +50,13 @@ describe('SaleDetailsPanel', () => {
|
||||||
customer: createUser('customer1'),
|
customer: createUser('customer1'),
|
||||||
lastTransitionedAt: new Date(Date.UTC(2017, 5, 10)),
|
lastTransitionedAt: new Date(Date.UTC(2017, 5, 10)),
|
||||||
});
|
});
|
||||||
const panel = shallow(<SaleDetailsPanel transaction={tx} />);
|
const props = {
|
||||||
|
transaction,
|
||||||
|
onAcceptSale: noop,
|
||||||
|
onRejectSale: noop,
|
||||||
|
acceptOrRejectInProgress: false,
|
||||||
|
};
|
||||||
|
const panel = shallow(<SaleDetailsPanel {...props} />);
|
||||||
const breakdownProps = panel.find(BookingBreakdown).props();
|
const breakdownProps = panel.find(BookingBreakdown).props();
|
||||||
|
|
||||||
// Total price for the provider should be transaction total minus the commission.
|
// Total price for the provider should be transaction total minus the commission.
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,14 @@ exports[`SaleDetailsPanel matches snapshot 1`] = `
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<SecondaryButton
|
<SecondaryButton
|
||||||
|
disabled={false}
|
||||||
onClick={[Function]}>
|
onClick={[Function]}>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id="SalePage.rejectButton"
|
id="SalePage.rejectButton"
|
||||||
values={Object {}} />
|
values={Object {}} />
|
||||||
</SecondaryButton>
|
</SecondaryButton>
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
|
disabled={false}
|
||||||
onClick={[Function]}>
|
onClick={[Function]}>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id="SalePage.acceptButton"
|
id="SalePage.acceptButton"
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ describe('SalePage', () => {
|
||||||
push: () => console.log('HistoryPush called'),
|
push: () => console.log('HistoryPush called'),
|
||||||
},
|
},
|
||||||
authInProgress: false,
|
authInProgress: false,
|
||||||
|
acceptOrRejectInProgress: false,
|
||||||
currentUserHasListings: false,
|
currentUserHasListings: false,
|
||||||
isAuthenticated: false,
|
isAuthenticated: false,
|
||||||
onLogout: noop,
|
onLogout: noop,
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ exports[`SalePage matches snapshot 1`] = `
|
||||||
onManageDisableScrolling={[Function]} />
|
onManageDisableScrolling={[Function]} />
|
||||||
<div>
|
<div>
|
||||||
<SaleDetailsPanel
|
<SaleDetailsPanel
|
||||||
|
acceptOrRejectInProgress={false}
|
||||||
className="undefined"
|
className="undefined"
|
||||||
lastTransition={null}
|
lastTransition={null}
|
||||||
onAcceptSale={[Function]}
|
onAcceptSale={[Function]}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue