2018-08-22 07:20:34 +00:00
|
|
|
const app = require(`${servicesDir}/ticket/server/server`);
|
|
|
|
|
|
|
|
describe('ticket summary()', () => {
|
|
|
|
it('should return a summary object containing data from 1 ticket', async() => {
|
|
|
|
let result = await app.models.Ticket.summary(1);
|
|
|
|
|
|
|
|
expect(result.id).toEqual(1);
|
2018-09-04 07:50:39 +00:00
|
|
|
expect(result.nickname).toEqual('address 21');
|
2018-08-22 07:20:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should return a summary object containing sales from 1 ticket', async() => {
|
|
|
|
let result = await app.models.Ticket.summary(1);
|
|
|
|
|
|
|
|
expect(result.sales.length).toEqual(4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return a summary object containing subTotal for 1 ticket', async() => {
|
|
|
|
let result = await app.models.Ticket.summary(1);
|
|
|
|
|
|
|
|
expect(result.subTotal).toEqual(389.5);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return a summary object containing VAT for 1 ticket', async() => {
|
|
|
|
let result = await app.models.Ticket.summary(1);
|
|
|
|
|
|
|
|
expect(result.VAT).toEqual(58.75);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return a summary object containing total for 1 ticket', async() => {
|
|
|
|
let result = await app.models.Ticket.summary(1);
|
|
|
|
let expectedTotal = result.subTotal + result.VAT;
|
|
|
|
|
|
|
|
expect(result.total).toEqual(expectedTotal);
|
|
|
|
});
|
|
|
|
});
|