Updated unit test

This commit is contained in:
Joan Sanchez 2020-06-10 13:57:08 +02:00
parent 3cfb8b4730
commit 461fec7e64
1 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,6 @@
const app = require('vn-loopback/server/server');
describe('ticket filter()', () => {
fdescribe('ticket filter()', () => {
it('should return the tickets matching the filter', async() => {
const ctx = {req: {accessToken: {userId: 9}}, args: {}};
const filter = {order: 'id DESC'};
@ -71,4 +71,20 @@ describe('ticket filter()', () => {
expect(secondRow.state).toEqual('Entregado');
expect(thirdRow.state).toEqual('Entregado');
});
it('should return the tickets from the worker team', async() => {
const ctx = {req: {accessToken: {userId: 9}}, args: {myTeam: true}};
const filter = {};
const result = await app.models.Ticket.filter(ctx, filter);
expect(result.length).toEqual(17);
});
it('should return the tickets that are not from the worker team', async() => {
const ctx = {req: {accessToken: {userId: 9}}, args: {myTeam: false}};
const filter = {};
const result = await app.models.Ticket.filter(ctx, filter);
expect(result.length).toEqual(7);
});
});