Add tx transitions to test data

This commit is contained in:
Hannu Lyytikainen 2017-11-09 18:45:28 +02:00
parent 2b7e79b3b1
commit 1292484476
8 changed files with 397 additions and 54 deletions

View file

@ -22,6 +22,13 @@ const exampleTransaction = params => {
createdAt: created,
lastTransitionedAt: created,
lastTransition: propTypes.TX_TRANSITION_PREAUTHORIZE,
transitions: [
{
at: created,
by: propTypes.TX_TRANSITION_ACTOR_CUSTOMER,
transition: propTypes.TX_TRANSITION_PREAUTHORIZE,
},
],
// payinTotal, payoutTotal, and lineItems required in params
...params,

View file

@ -17,6 +17,13 @@ const exampleTransaction = params => {
createdAt: created,
lastTransitionedAt: created,
lastTransition: propTypes.TX_TRANSITION_PREAUTHORIZE,
transitions: [
{
at: created,
by: propTypes.TX_TRANSITION_ACTOR_CUSTOMER,
transition: propTypes.TX_TRANSITION_PREAUTHORIZE,
},
],
// payinTotal, payoutTotal, and lineItems required in params
...params,

View file

@ -144,6 +144,18 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -428,6 +440,18 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -632,6 +656,18 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -916,6 +952,18 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1043,7 +1091,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
<span>
<span>
<FormattedMessage
id="OrderDetailsPanel.orderPreauthorizedTitle"
id="OrderDetailsPanel.orderAcceptedTitle"
values={
Object {
"customerName": "customer display name",
@ -1052,7 +1100,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
/>
</span>
<FormattedMessage
id="OrderDetailsPanel.orderPreauthorizedSubtitle"
id="OrderDetailsPanel.orderAcceptedSubtitle"
values={
Object {
"listingLink": <NamedLink
@ -1071,17 +1119,6 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
/>
</span>
</h1>
<p>
<FormattedMessage
id="OrderDetailsPanel.orderPreauthorizedStatus"
values={
Object {
"providerName": "provider display name",
}
}
/>
</p>
<hr />
<div>
<h3>
<FormattedMessage
@ -1106,7 +1143,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
Object {
"attributes": Object {
"createdAt": 2017-05-01T00:00:00.000Z,
"lastTransition": "transition/preauthorize",
"lastTransition": "transition/accept",
"lastTransitionedAt": 2017-06-01T00:00:00.000Z,
"lineItems": Array [
Object {
@ -1143,6 +1180,18 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1211,7 +1260,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
/>
</div>
<div
className="undefined"
className=""
>
<h3>
<FormattedMessage
@ -1390,7 +1439,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
Object {
"attributes": Object {
"createdAt": 2017-05-01T00:00:00.000Z,
"lastTransition": "transition/preauthorize",
"lastTransition": "transition/accept",
"lastTransitionedAt": 2017-06-01T00:00:00.000Z,
"lineItems": Array [
Object {
@ -1427,6 +1476,18 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1631,6 +1692,18 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1915,6 +1988,18 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2119,6 +2204,18 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2403,6 +2500,18 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2630,6 +2739,18 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2914,6 +3035,18 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
"amount": 16400,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {

View file

@ -151,6 +151,18 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -379,6 +391,18 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -590,6 +614,18 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -818,6 +854,18 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -948,7 +996,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
</div>
<h1>
<FormattedMessage
id="SaleDetailsPanel.listingRequestedTitle"
id="SaleDetailsPanel.listingAcceptedTitle"
values={
Object {
"customerName": "customer1 display name",
@ -967,16 +1015,6 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
}
/>
</h1>
<p>
<FormattedMessage
id="SaleDetailsPanel.saleRequestedStatus"
values={
Object {
"customerName": "customer1 display name",
}
}
/>
</p>
<div />
<div>
<h3>
@ -1002,7 +1040,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
Object {
"attributes": Object {
"createdAt": 2017-05-01T00:00:00.000Z,
"lastTransition": "transition/preauthorize",
"lastTransition": "transition/accept",
"lastTransitionedAt": 2017-06-10T00:00:00.000Z,
"lineItems": Array [
Object {
@ -1039,6 +1077,18 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1095,7 +1145,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
/>
</div>
<div
className="undefined"
className=""
>
<h3>
<FormattedMessage
@ -1180,29 +1230,6 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
}
/>
</div>
<div>
<div />
<SecondaryButton
disabled={false}
inProgress={false}
onClick={[Function]}
>
<FormattedMessage
id="SalePage.declineButton"
values={Object {}}
/>
</SecondaryButton>
<PrimaryButton
disabled={false}
inProgress={false}
onClick={[Function]}
>
<FormattedMessage
id="SalePage.acceptButton"
values={Object {}}
/>
</PrimaryButton>
</div>
</div>
<div>
<div>
@ -1253,7 +1280,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
Object {
"attributes": Object {
"createdAt": 2017-05-01T00:00:00.000Z,
"lastTransition": "transition/preauthorize",
"lastTransition": "transition/accept",
"lastTransitionedAt": 2017-06-10T00:00:00.000Z,
"lineItems": Array [
Object {
@ -1290,6 +1317,18 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1501,6 +1540,18 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1729,6 +1780,18 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -1940,6 +2003,18 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2168,6 +2243,18 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2389,6 +2476,18 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -2640,6 +2739,18 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
"amount": 15500,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {

View file

@ -130,6 +130,18 @@ exports[`InboxPage matches snapshot 1`] = `
"amount": 900,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -232,6 +244,18 @@ exports[`InboxPage matches snapshot 1`] = `
"amount": 900,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -492,6 +516,18 @@ exports[`InboxPage matches snapshot 3`] = `
"amount": 900,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {
@ -594,6 +630,18 @@ exports[`InboxPage matches snapshot 3`] = `
"amount": 900,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {

View file

@ -89,6 +89,18 @@ exports[`OrderPage matches snapshot 1`] = `
"amount": 900,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {

View file

@ -95,6 +95,18 @@ exports[`SalePage matches snapshot 1`] = `
"amount": 900,
"currency": "USD",
},
"transitions": Array [
Object {
"at": 2017-05-01T00:00:00.000Z,
"by": "customer",
"transition": "transition/preauthorize",
},
Object {
"at": 2017-06-01T00:00:00.000Z,
"by": "provider",
"transition": "transition/accept",
},
],
},
"booking": Object {
"attributes": Object {

View file

@ -89,7 +89,7 @@ export const createListing = (id, attributes = {}, includes = {}) => ({
export const createTransaction = options => {
const {
id,
lastTransition = propTypes.TX_TRANSITION_PREAUTHORIZE,
lastTransition = propTypes.TX_TRANSITION_ACCEPT,
total = new Money(1000, 'USD'),
commission = new Money(100, 'USD'),
booking = null,
@ -97,6 +97,18 @@ export const createTransaction = options => {
customer = null,
provider = null,
lastTransitionedAt = new Date(Date.UTC(2017, 5, 1)),
transitions = [
{
at: new Date(Date.UTC(2017, 4, 1)),
by: propTypes.TX_TRANSITION_ACTOR_CUSTOMER,
transition: propTypes.TX_TRANSITION_PREAUTHORIZE,
},
{
at: new Date(Date.UTC(2017, 5, 1)),
by: propTypes.TX_TRANSITION_ACTOR_PROVIDER,
transition: propTypes.TX_TRANSITION_ACCEPT,
},
],
} = options;
const nightCount = booking ? nightsBetween(booking.attributes.start, booking.attributes.end) : 1;
return {
@ -123,6 +135,7 @@ export const createTransaction = options => {
reversal: false,
},
],
transitions,
},
booking,
listing,