Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
gerard 2018-08-22 12:41:25 +02:00
commit e391b22eaf
2 changed files with 51 additions and 10 deletions

View File

@ -0,0 +1,18 @@
const app = require(`${servicesDir}/item/server/server`);
describe('item filter()', () => {
it('should return 1 result using filter and tags', async() => {
let filter = {
order: 'isActive ASC, name',
limit: 8,
where: {and: [{typeFk: 2}]}
};
let tags = [{value: 'Gem2', tagFk: 58}];
let result = await app.models.Item.filter(filter, tags);
expect(result.length).toEqual(1);
expect(result[0].id).toEqual(2);
expect(result[0].name).toEqual('Gem of Mind');
expect(result[0].type).toEqual('Anthurium');
});
});

View File

@ -1,12 +1,35 @@
// const app = require(`${servicesDir}/ticket/server/server`);
const app = require(`${servicesDir}/ticket/server/server`);
// describe('ticket summary()', () => {
// describe('getTicketData()', () => {
// it('should sum all sales price', done => {
// let result = getTicketData(model, 1);
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).toEqual("pepinillos");
// done();
// });
// });
// });
expect(result.id).toEqual(1);
expect(result.nickname).toEqual('Batman');
});
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);
});
});