From c9c9d5973d360f5a7794537efd539b7978d5aa13 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sat, 20 Jul 2024 00:36:59 +0200 Subject: [PATCH] test(salix): refs #6321 #6321 fix test --- db/dump/fixtures.before.sql | 9 +++++++++ .../back/methods/route/specs/unlink.spec.js | 2 +- modules/ticket/back/methods/ticket/itemLack.js | 6 +++--- .../back/methods/ticket/specs/itemLack.spec.js | 16 ++++++++-------- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index fffdcf7df..26210bcc8 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3953,3 +3953,12 @@ VALUES (4, 'Referencia Transferencias'), (5, 'Referencia Nominas'), (6, 'ABA'); +INSERT INTO `vn`.`item` (id,name,`size`,stems,minPrice,isToPrint,family,box,originFk,doPhoto,image,inkFk,intrastatFk,hasMinPrice,created,typeFk,generic,density,relevancy,expenseFk,isActive,longName,subName,tag5,value5,tag6,value6,tag7,value7,minimum,upToDown,hasKgPrice,isFloramondo,isFragile,stemMultiplier,isLaid,lastUsed,editorFk,isBoxPickingMode) + VALUES + (88,'Lack negative',200,1,10.0,0,'VT',0,2,0,'','WHT',6021010,1,'2024-07-19 11:27:32.000',1,0,167,0,'4751000000',1,'Lack negative origin','Stark Industries','Color','White','Categoria','supply','Tallos','1',3,0,0,0,0,1.0,0,'2024-07-19 11:27:32.000',100,0); + +INSERT INTO `vn`.`ticket` (id, clientFk,warehouseFk,shipped,nickname,refFk,addressFk,workerFk,observations,isSigned,isLabeled,isPrinted,packages,location,`hour`,created,isBlocked,solution,routeFk,priority,hasPriority,companyFk,agencyModeFk,landed,isBoxed,isDeleted,zoneFk,zonePrice,zoneBonus,totalWithVat,totalWithoutVat,weight,clonedFrom,cmrFk,editorFk,problem,risk) VALUES + (1000000, 1,1,'2001-01-01 00:00:00.000','employee',NULL,131,NULL,NULL,0,0,0,0,NULL,0,'2024-07-19 23:32:48.000',1,NULL,NULL,NULL,1,442,1,'2001-01-01',0,0,1,1.00,0.00,0.00,NULL,NULL,NULL,NULL,9,'',NULL); + +INSERT INTO `vn`.`sale` (id, itemFk,ticketFk,concept,quantity,originalQuantity,price,discount,priceFixed,reserved,isPicked,isPriceFixed,created,isAdded,total,editorFk,problem) VALUES + (43, 88,1000000,'Chest medical box 2',155.00,155.0,0.00,0,0.00,0,0,0,'2024-07-19 23:33:08.000',0,0.00,100,''); diff --git a/modules/route/back/methods/route/specs/unlink.spec.js b/modules/route/back/methods/route/specs/unlink.spec.js index 808cedccc..a543ab416 100644 --- a/modules/route/back/methods/route/specs/unlink.spec.js +++ b/modules/route/back/methods/route/specs/unlink.spec.js @@ -21,7 +21,7 @@ describe('route unlink()', () => { zoneAgencyModes = await models.ZoneAgencyMode.find(null, options); tickets = await models.Route.getSuggestedTickets(routeId, options); - expect(zoneAgencyModes.length).toEqual(3); + expect(zoneAgencyModes.length).toEqual(4); expect(tickets.length).toEqual(0); await tx.rollback(); diff --git a/modules/ticket/back/methods/ticket/itemLack.js b/modules/ticket/back/methods/ticket/itemLack.js index c48ecc09c..6430a63ab 100644 --- a/modules/ticket/back/methods/ticket/itemLack.js +++ b/modules/ticket/back/methods/ticket/itemLack.js @@ -15,7 +15,7 @@ module.exports = Self => { http: {source: 'query'} }, { - arg: 'id', + arg: 'itemFk', type: 'number', description: 'The item id', }, @@ -45,7 +45,7 @@ module.exports = Self => { description: 'origen id', }, { - arg: 'warehouse', + arg: 'warehouseFk', type: 'number', description: 'The warehouse id', }, @@ -79,7 +79,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const filterKeyOrder = ['days', 'id', 'longname', 'supplier', 'colour', 'size', 'origen', 'lack', 'warehouse']; + const filterKeyOrder = ['days', 'itemFk', 'longname', 'supplier', 'colour', 'size', 'origen', 'lack', 'warehouseFk']; delete ctx?.args?.ctx; diff --git a/modules/ticket/back/methods/ticket/specs/itemLack.spec.js b/modules/ticket/back/methods/ticket/specs/itemLack.spec.js index 4ca82b24d..2fe928774 100644 --- a/modules/ticket/back/methods/ticket/specs/itemLack.spec.js +++ b/modules/ticket/back/methods/ticket/specs/itemLack.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -describe('Item Lack', () => { +fdescribe('Item Lack', () => { beforeEach(async() => { ctx = { req: { @@ -18,7 +18,7 @@ describe('Item Lack', () => { try { const result = await models.Ticket.itemLack(ctx, filter, options); - expect(result.length).toEqual(4); + expect(result.length).toEqual(2); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -31,7 +31,7 @@ describe('Item Lack', () => { const options = {transaction: tx}; const filter = { - id: 1 + id: 88 }; try { const result = await models.Ticket.itemLack(ctx, filter, options); @@ -49,7 +49,7 @@ describe('Item Lack', () => { const options = {transaction: tx}; const filter = { - longname: 'Ranged weapon longbow 200cm' + longname: 'Lack negative' }; try { const result = await models.Ticket.itemLack(ctx, filter, options); @@ -85,7 +85,7 @@ describe('Item Lack', () => { const options = {transaction: tx}; const filter = { - colour: 'BRW' + colour: 'WHT' }; try { const result = await models.Ticket.itemLack(ctx, filter, options); @@ -103,12 +103,12 @@ describe('Item Lack', () => { const options = {transaction: tx}; const filter = { - origen: 2 + origen: 1 }; try { const result = await models.Ticket.itemLack(ctx, filter, options); - expect(result.length).toEqual(3); + expect(result.length).toEqual(2); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -139,7 +139,7 @@ describe('Item Lack', () => { const options = {transaction: tx}; const filter = { - lack: '-100' + lack: '-155' }; try { const result = await models.Ticket.itemLack(ctx, filter, options);