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