fixed ticket-weekly backend unit test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-09-22 16:53:47 +02:00
parent 97fb4c5b31
commit 87e4765a1c
5 changed files with 7 additions and 8 deletions

View File

@ -8,7 +8,6 @@ describe('route updateVolume()', () => {
let ticketToRestore; let ticketToRestore;
let logIdToDestroy; let logIdToDestroy;
afterAll(async done => { afterAll(async done => {
await originalRoute.updateAttributes({m3: 1.8}); await originalRoute.updateAttributes({m3: 1.8});
await ticketToRestore.updateAttributes({routeFk: null}); await ticketToRestore.updateAttributes({routeFk: null});

View File

@ -2,13 +2,15 @@ const app = require('vn-loopback/server/server');
describe('ticket-weekly filter()', () => { describe('ticket-weekly filter()', () => {
const authUserId = 9; const authUserId = 9;
it('should return the tickets matching the filter', async() => { it('should all return the tickets matching the filter', async() => {
const ctx = {req: {accessToken: {userId: authUserId}}, args: {}}; const filter = {order: 't.id ASC'};
const filter = {order: 'id DESC'}; const ctx = {req: {accessToken: {userId: authUserId}}, args: {filter: filter}};
const result = await app.models.TicketWeekly.filter(ctx, filter); const result = await app.models.TicketWeekly.filter(ctx);
const firstRow = result[0]; const firstRow = result[0];
expect(firstRow.ticketFk).toEqual(1); expect(firstRow.ticketFk).toEqual(1);
expect(result.length).toEqual(5);
}); });
it('should return the ticket with id one', async() => { it('should return the ticket with id one', async() => {

View File

@ -35,7 +35,6 @@ describe('sale priceDifference()', () => {
error = e; error = e;
}); });
expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`)); expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`));
}); });
}); });

View File

@ -25,7 +25,7 @@ describe('ticket setDeleted()', () => {
expect(error.message).toEqual('You must delete the claim id %d first'); expect(error.message).toEqual('You must delete the claim id %d first');
}); });
it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get ride of the itemshelving', async() => { it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => {
const employeeUser = 110; const employeeUser = 110;
const ctx = { const ctx = {
req: { req: {

View File

@ -26,7 +26,6 @@ describe('ticket updateEditableTicket()', () => {
expect(error).toBeDefined(); expect(error).toBeDefined();
}); });
it('should edit the ticket address', async() => { it('should edit the ticket address', async() => {
let ctx = {req: {accessToken: {userId: 9}}}; let ctx = {req: {accessToken: {userId: 9}}};