Updated unit test
This commit is contained in:
parent
3cfb8b4730
commit
461fec7e64
|
@ -1,6 +1,6 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('ticket filter()', () => {
|
fdescribe('ticket filter()', () => {
|
||||||
it('should return the tickets matching the filter', async() => {
|
it('should return the tickets matching the filter', async() => {
|
||||||
const ctx = {req: {accessToken: {userId: 9}}, args: {}};
|
const ctx = {req: {accessToken: {userId: 9}}, args: {}};
|
||||||
const filter = {order: 'id DESC'};
|
const filter = {order: 'id DESC'};
|
||||||
|
@ -71,4 +71,20 @@ describe('ticket filter()', () => {
|
||||||
expect(secondRow.state).toEqual('Entregado');
|
expect(secondRow.state).toEqual('Entregado');
|
||||||
expect(thirdRow.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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue