diff --git a/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js b/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js
index 33902d45..1401b57e 100644
--- a/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js
+++ b/src/components/OrderDetailsPanel/OrderDetailsPanel.test.js
@@ -4,12 +4,16 @@ import { types } from '../../util/sdkLoader';
import { createBooking, createListing, createUser, createTransaction } from '../../util/test-data';
import { renderShallow } from '../../util/test-helpers';
import { fakeIntl } from '../../util/test-data';
-import { TX_TRANSITION_PREAUTHORIZE } from '../../util/propTypes';
+import {
+ TX_TRANSITION_PREAUTHORIZE,
+ TX_TRANSITION_REJECT,
+ TX_TRANSITION_AUTO_REJECT,
+} from '../../util/propTypes';
import { BookingBreakdown } from '../../components';
import { OrderDetailsPanelComponent } from './OrderDetailsPanel.js';
describe('OrderDetailsPanel', () => {
- it('matches snapshot', () => {
+ it('preauthorized matches snapshot', () => {
const { Money } = types;
const tx = createTransaction({
id: 'order-tx',
@@ -26,6 +30,40 @@ describe('OrderDetailsPanel', () => {
const tree = renderShallow();
expect(tree).toMatchSnapshot();
});
+ it('rejected matches snapshot', () => {
+ const { Money } = types;
+ const tx = createTransaction({
+ id: 'order-rejected',
+ lastTransition: TX_TRANSITION_REJECT,
+ total: new Money(16500, 'USD'),
+ booking: createBooking('booking1', {
+ start: new Date(Date.UTC(2017, 5, 10)),
+ end: new Date(Date.UTC(2017, 5, 13)),
+ }),
+ listing: createListing('listing1'),
+ provider: createUser('provider'),
+ customer: createUser('customer'),
+ });
+ const tree = renderShallow();
+ expect(tree).toMatchSnapshot();
+ });
+ it('autorejected matches snapshot', () => {
+ const { Money } = types;
+ const tx = createTransaction({
+ id: 'order-autorejected',
+ lastTransition: TX_TRANSITION_AUTO_REJECT,
+ total: new Money(16500, 'USD'),
+ booking: createBooking('booking1', {
+ start: new Date(Date.UTC(2017, 5, 10)),
+ end: new Date(Date.UTC(2017, 5, 13)),
+ }),
+ listing: createListing('listing1'),
+ provider: createUser('provider'),
+ customer: createUser('customer'),
+ });
+ const tree = renderShallow();
+ expect(tree).toMatchSnapshot();
+ });
it('renders correct total price', () => {
const { Money } = types;
const tx = createTransaction({
diff --git a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap
index 24dad4a0..a1e39649 100644
--- a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap
+++ b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap
@@ -1,4 +1,389 @@
-exports[`OrderDetailsPanel matches snapshot 1`] = `
+exports[`OrderDetailsPanel autorejected matches snapshot 1`] = `
+
+
+
+
+
+
+
+
+
+ listing1 title
+ ,
+ }
+ } />
+
+
+
+
+ ,
+ }
+ } />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ listing1 title
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
@@ -171,13 +556,12 @@ exports[`OrderDetailsPanel matches snapshot 1`] = `
"listing": Object {
"attributes": Object {
"address": "listing1 address",
- "closed": false,
- "deleted": false,
"description": "listing1 description",
"geolocation": LatLng {
"lat": 40,
"lng": 60,
},
+ "open": true,
"price": Money {
"amount": 5500,
"currency": "USD",
@@ -345,6 +729,392 @@ exports[`OrderDetailsPanel matches snapshot 1`] = `
"id": UUID {
"uuid": "order-tx",
},
+ "listing": Object {
+ "attributes": Object {
+ "address": "listing1 address",
+ "description": "listing1 description",
+ "geolocation": LatLng {
+ "lat": 40,
+ "lng": 60,
+ },
+ "open": true,
+ "price": Money {
+ "amount": 5500,
+ "currency": "USD",
+ },
+ "title": "listing1 title",
+ },
+ "id": UUID {
+ "uuid": "listing1",
+ },
+ "type": "listing",
+ },
+ "provider": Object {
+ "attributes": Object {
+ "banned": false,
+ "profile": Object {
+ "abbreviatedName": "provider abbreviated name",
+ "displayName": "provider display name",
+ },
+ },
+ "id": UUID {
+ "uuid": "provider",
+ },
+ "type": "user",
+ },
+ "type": "transaction",
+ }
+ }
+ userRole="customer" />
+
+
+
+
+`;
+
+exports[`OrderDetailsPanel rejected matches snapshot 1`] = `
+
+
+
+
+
+
+
+
+
+ listing1 title
+ ,
+ }
+ } />
+
+
+
+
+ ,
+ }
+ } />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ listing1 title
+
+
+
+
+
+
+
+
+
null;
describe('SaleDetailsPanel', () => {
- it('matches snapshot', () => {
+ it('preauthorized matches snapshot', () => {
const { Money } = types;
const transaction = createTransaction({
id: 'sale-tx',
@@ -37,6 +41,58 @@ describe('SaleDetailsPanel', () => {
const tree = renderShallow();
expect(tree).toMatchSnapshot();
});
+ it('rejected matches snapshot', () => {
+ const { Money } = types;
+ const transaction = createTransaction({
+ id: 'sale-tx',
+ lastTransition: TX_TRANSITION_REJECT,
+ total: new Money(16500, 'USD'),
+ commission: new Money(1000, 'USD'),
+ booking: createBooking('booking1', {
+ start: new Date(Date.UTC(2017, 5, 10)),
+ end: new Date(Date.UTC(2017, 5, 13)),
+ }),
+ listing: createListing('listing1'),
+ customer: createUser('customer1'),
+ lastTransitionedAt: new Date(Date.UTC(2017, 5, 10)),
+ });
+ const props = {
+ transaction,
+ onAcceptSale: noop,
+ onRejectSale: noop,
+ acceptInProgress: false,
+ rejectInProgress: false,
+ intl: fakeIntl,
+ };
+ const tree = renderShallow();
+ expect(tree).toMatchSnapshot();
+ });
+ it('autorejected matches snapshot', () => {
+ const { Money } = types;
+ const transaction = createTransaction({
+ id: 'sale-tx',
+ lastTransition: TX_TRANSITION_AUTO_REJECT,
+ total: new Money(16500, 'USD'),
+ commission: new Money(1000, 'USD'),
+ booking: createBooking('booking1', {
+ start: new Date(Date.UTC(2017, 5, 10)),
+ end: new Date(Date.UTC(2017, 5, 13)),
+ }),
+ listing: createListing('listing1'),
+ customer: createUser('customer1'),
+ lastTransitionedAt: new Date(Date.UTC(2017, 5, 10)),
+ });
+ const props = {
+ transaction,
+ onAcceptSale: noop,
+ onRejectSale: noop,
+ acceptInProgress: false,
+ rejectInProgress: false,
+ intl: fakeIntl,
+ };
+ const tree = renderShallow();
+ expect(tree).toMatchSnapshot();
+ });
it('renders correct total price', () => {
const { Money } = types;
const transaction = createTransaction({
diff --git a/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap b/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap
index e723112c..b2df6870 100644
--- a/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap
+++ b/src/components/SaleDetailsPanel/__snapshots__/SaleDetailsPanel.test.js.snap
@@ -1,4 +1,352 @@
-exports[`SaleDetailsPanel matches snapshot 1`] = `
+exports[`SaleDetailsPanel autorejected matches snapshot 1`] = `
+
+
+
+
+
+
+
+
+
+
+ listing1 title
+ ,
+ }
+ } />
+
+
+
+
+ ,
+ }
+ } />
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
@@ -197,13 +545,12 @@ exports[`SaleDetailsPanel matches snapshot 1`] = `
"listing": Object {
"attributes": Object {
"address": "listing1 address",
- "closed": false,
- "deleted": false,
"description": "listing1 description",
"geolocation": LatLng {
"lat": 40,
"lng": 60,
},
+ "open": true,
"price": Money {
"amount": 5500,
"currency": "USD",
@@ -328,6 +675,355 @@ exports[`SaleDetailsPanel matches snapshot 1`] = `
"id": UUID {
"uuid": "sale-tx",
},
+ "listing": Object {
+ "attributes": Object {
+ "address": "listing1 address",
+ "description": "listing1 description",
+ "geolocation": LatLng {
+ "lat": 40,
+ "lng": 60,
+ },
+ "open": true,
+ "price": Money {
+ "amount": 5500,
+ "currency": "USD",
+ },
+ "title": "listing1 title",
+ },
+ "id": UUID {
+ "uuid": "listing1",
+ },
+ "type": "listing",
+ },
+ "provider": null,
+ "type": "transaction",
+ }
+ }
+ userRole="provider" />
+
+
+
+
+`;
+
+exports[`SaleDetailsPanel rejected matches snapshot 1`] = `
+
+
+
+
+
+
+
+
+
+
+ listing1 title
+ ,
+ }
+ } />
+
+
+
+
+ ,
+ }
+ } />
+
+
+
+
+
+
+
+
+
+