Update tests

This commit is contained in:
Vesa Luusua 2019-03-25 14:38:24 +02:00
parent 97c7654073
commit 3ff963192a
6 changed files with 150 additions and 16 deletions

View file

@ -31,12 +31,17 @@ const { Money } = sdkTypes;
describe('TransactionPanel - Sale', () => {
const providerId = 'provider';
const customerId = 'customer';
const start = new Date(Date.UTC(2017, 5, 10));
const end = new Date(Date.UTC(2017, 5, 13));
const baseTxAttrs = {
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)),
start,
end,
displayStart: start,
displayEnd: end,
}),
listing: createListing('listing1'),
customer: createUser(customerId),
@ -187,14 +192,19 @@ describe('TransactionPanel - Sale', () => {
expect(tree).toMatchSnapshot();
});
it('renders correct total price', () => {
const start = new Date(Date.UTC(2017, 5, 10));
const end = new Date(Date.UTC(2017, 5, 13));
const transaction = createTransaction({
id: 'sale-tx',
lastTransition: TRANSITION_REQUEST,
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)),
start,
end,
displayStart: start,
displayEnd: end,
}),
listing: createListing('listing1'),
customer: createUser('customer1'),
@ -219,11 +229,15 @@ describe('TransactionPanel - Sale', () => {
describe('TransactionPanel - Order', () => {
const providerId = 'provider';
const customerId = 'customer';
const start = new Date(Date.UTC(2017, 5, 10));
const end = new Date(Date.UTC(2017, 5, 13));
const baseTxAttrs = {
total: new Money(16500, 'USD'),
booking: createBooking('booking1', {
start: new Date(Date.UTC(2017, 5, 10)),
end: new Date(Date.UTC(2017, 5, 13)),
start,
end,
displayStart: start,
displayEnd: end,
}),
listing: createListing('listing1'),
provider: createUser(providerId),
@ -375,13 +389,17 @@ describe('TransactionPanel - Order', () => {
expect(tree).toMatchSnapshot();
});
it('renders correct total price', () => {
const start = new Date(Date.UTC(2017, 5, 10));
const end = new Date(Date.UTC(2017, 5, 13));
const tx = createTransaction({
id: 'order-tx',
lastTransition: TRANSITION_REQUEST,
total: new Money(16500, 'USD'),
booking: createBooking('booking1', {
start: new Date(Date.UTC(2017, 5, 10)),
end: new Date(Date.UTC(2017, 5, 13)),
start,
end,
displayStart: start,
displayEnd: end,
}),
listing: createListing('listing1'),
provider: createUser(providerId),

View file

@ -181,6 +181,8 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -311,6 +313,8 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -570,6 +574,8 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -867,6 +873,8 @@ exports[`TransactionPanel - Order autodeclined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -997,6 +1005,8 @@ exports[`TransactionPanel - Order autodeclined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -1255,6 +1265,8 @@ exports[`TransactionPanel - Order autodeclined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -1553,6 +1565,8 @@ exports[`TransactionPanel - Order canceled matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -1683,6 +1697,8 @@ exports[`TransactionPanel - Order canceled matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -1942,6 +1958,8 @@ exports[`TransactionPanel - Order canceled matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -2239,6 +2257,8 @@ exports[`TransactionPanel - Order declined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -2369,6 +2389,8 @@ exports[`TransactionPanel - Order declined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -2627,6 +2649,8 @@ exports[`TransactionPanel - Order declined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -2930,6 +2954,8 @@ exports[`TransactionPanel - Order delivered matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -3065,6 +3091,8 @@ exports[`TransactionPanel - Order delivered matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -3329,6 +3357,8 @@ exports[`TransactionPanel - Order delivered matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -3626,6 +3656,8 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -3756,6 +3788,8 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -4013,6 +4047,8 @@ exports[`TransactionPanel - Order enquired matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -4310,6 +4346,8 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -4440,6 +4478,8 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -4698,6 +4738,8 @@ exports[`TransactionPanel - Order preauthorized matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -4996,6 +5038,8 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -5126,6 +5170,8 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -5385,6 +5431,8 @@ exports[`TransactionPanel - Sale accepted matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -5682,6 +5730,8 @@ exports[`TransactionPanel - Sale autodeclined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -5812,6 +5862,8 @@ exports[`TransactionPanel - Sale autodeclined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -6070,6 +6122,8 @@ exports[`TransactionPanel - Sale autodeclined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -6368,6 +6422,8 @@ exports[`TransactionPanel - Sale canceled matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -6498,6 +6554,8 @@ exports[`TransactionPanel - Sale canceled matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -6757,6 +6815,8 @@ exports[`TransactionPanel - Sale canceled matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -7054,6 +7114,8 @@ exports[`TransactionPanel - Sale declined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -7184,6 +7246,8 @@ exports[`TransactionPanel - Sale declined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -7442,6 +7506,8 @@ exports[`TransactionPanel - Sale declined matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -7745,6 +7811,8 @@ exports[`TransactionPanel - Sale delivered matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -7880,6 +7948,8 @@ exports[`TransactionPanel - Sale delivered matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -8144,6 +8214,8 @@ exports[`TransactionPanel - Sale delivered matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -8441,6 +8513,8 @@ exports[`TransactionPanel - Sale enquired matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -8571,6 +8645,8 @@ exports[`TransactionPanel - Sale enquired matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -8828,6 +8904,8 @@ exports[`TransactionPanel - Sale enquired matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -9125,6 +9203,8 @@ exports[`TransactionPanel - Sale preauthorized matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -9255,6 +9335,8 @@ exports[`TransactionPanel - Sale preauthorized matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -9513,6 +9595,8 @@ exports[`TransactionPanel - Sale preauthorized matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},

View file

@ -22,13 +22,24 @@ describe('InboxPage', () => {
const currentUserProvider = createCurrentUser('provider-user-id');
const currentUserCustomer = createCurrentUser('customer-user-id');
const startBooking1 = new Date(Date.UTC(2017, 1, 15));
const endBooking1 = new Date(Date.UTC(2017, 1, 16));
const booking1 = createBooking('booking1', {
start: new Date(Date.UTC(2017, 1, 15)),
end: new Date(Date.UTC(2017, 1, 16)),
start: startBooking1,
end: endBooking1,
displayStart: startBooking1,
displayEnd: endBooking1,
});
const startBooking2 = new Date(Date.UTC(2017, 2, 15));
const endBooking2 = new Date(Date.UTC(2017, 2, 16));
const booking2 = createBooking('booking2', {
start: new Date(Date.UTC(2017, 2, 15)),
end: new Date(Date.UTC(2017, 2, 16)),
start: startBooking2,
end: endBooking2,
displayStart: startBooking2,
displayEnd: endBooking2,
});
const ordersProps = {

View file

@ -163,6 +163,8 @@ exports[`InboxPage matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-02-16T00:00:00.000Z,
"displayStart": 2017-02-15T00:00:00.000Z,
"end": 2017-02-16T00:00:00.000Z,
"start": 2017-02-15T00:00:00.000Z,
},
@ -299,6 +301,8 @@ exports[`InboxPage matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-03-16T00:00:00.000Z,
"displayStart": 2017-03-15T00:00:00.000Z,
"end": 2017-03-16T00:00:00.000Z,
"start": 2017-03-15T00:00:00.000Z,
},
@ -581,6 +585,8 @@ exports[`InboxPage matches snapshot 3`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-02-16T00:00:00.000Z,
"displayStart": 2017-02-15T00:00:00.000Z,
"end": 2017-02-16T00:00:00.000Z,
"start": 2017-02-15T00:00:00.000Z,
},
@ -717,6 +723,8 @@ exports[`InboxPage matches snapshot 3`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-03-16T00:00:00.000Z,
"displayStart": 2017-03-15T00:00:00.000Z,
"end": 2017-03-16T00:00:00.000Z,
"start": 2017-03-15T00:00:00.000Z,
},

View file

@ -16,12 +16,16 @@ const noop = () => null;
describe('TransactionPage - Sale', () => {
it('matches snapshot', () => {
const txId = 'tx-sale-1';
const start = new Date(Date.UTC(2017, 5, 10));
const end = new Date(Date.UTC(2017, 5, 13));
const transaction = createTransaction({
id: txId,
lastTransition: TRANSITION_REQUEST,
booking: createBooking('booking1', {
start: new Date(Date.UTC(2017, 5, 10)),
end: new Date(Date.UTC(2017, 5, 13)),
start,
end,
displayStart: start,
displayEnd: end,
}),
listing: createListing('listing1'),
customer: createUser('customer1'),
@ -68,12 +72,17 @@ describe('TransactionPage - Sale', () => {
describe('TransactionPage - Order', () => {
it('matches snapshot', () => {
const txId = 'tx-order-1';
const start = new Date(Date.UTC(2017, 5, 10));
const end = new Date(Date.UTC(2017, 5, 13));
const transaction = createTransaction({
id: txId,
lastTransition: TRANSITION_REQUEST,
booking: createBooking('booking1', {
start: new Date(Date.UTC(2017, 5, 10)),
end: new Date(Date.UTC(2017, 5, 13)),
start,
end,
displayStart: start,
displayEnd: end,
}),
listing: createListing('listing1'),
customer: createUser('customer1'),

View file

@ -125,6 +125,8 @@ exports[`TransactionPage - Order matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},
@ -327,6 +329,8 @@ exports[`TransactionPage - Sale matches snapshot 1`] = `
},
"booking": Object {
"attributes": Object {
"displayEnd": 2017-06-13T00:00:00.000Z,
"displayStart": 2017-06-10T00:00:00.000Z,
"end": 2017-06-13T00:00:00.000Z,
"start": 2017-06-10T00:00:00.000Z,
},