diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index faaeb82c07..7f744ba58e 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -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); + }); });