test(ticket_volume): backTest
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c9564e817a
commit
757fe73ecd
|
@ -1,3 +1,6 @@
|
||||||
|
USE vn;
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
CREATE OR REPLACE
|
CREATE OR REPLACE
|
||||||
ALGORITHM = UNDEFINED VIEW `vn`.`saleVolume` AS
|
ALGORITHM = UNDEFINED VIEW `vn`.`saleVolume` AS
|
||||||
select
|
select
|
||||||
|
@ -31,5 +34,5 @@ join `itemCost` `ic` on
|
||||||
and `ic`.`warehouseFk` = `t`.`warehouseFk`))
|
and `ic`.`warehouseFk` = `t`.`warehouseFk`))
|
||||||
where
|
where
|
||||||
`s`.`quantity` > 0;
|
`s`.`quantity` > 0;
|
||||||
|
$$
|
||||||
-- NO FUNCIONA
|
DELIMITER ;
|
||||||
|
|
|
@ -29,11 +29,15 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const saleVolume = await Self.rawSql(`SELECT * FROM vn.saleVolume
|
const saleVolume = await Self.rawSql(`
|
||||||
|
SELECT saleFk, volume
|
||||||
|
FROM vn.saleVolume
|
||||||
WHERE ticketFk = ?`, [ticketFk], myOptions);
|
WHERE ticketFk = ?`, [ticketFk], myOptions);
|
||||||
|
|
||||||
const packingTypeVolume = await Self.rawSql(`
|
const packingTypeVolume = await Self.rawSql(`
|
||||||
SELECT s.itemPackingTypeFk code, i.description, SUM(s.volume) volume
|
SELECT s.itemPackingTypeFk code,
|
||||||
|
i.description,
|
||||||
|
SUM(s.volume) volume
|
||||||
FROM vn.saleVolume s
|
FROM vn.saleVolume s
|
||||||
LEFT JOIN vn.itemPackingType i
|
LEFT JOIN vn.itemPackingType i
|
||||||
ON i.code = s.itemPackingTypeFk
|
ON i.code = s.itemPackingTypeFk
|
||||||
|
|
|
@ -9,8 +9,11 @@ describe('ticket getVolume()', () => {
|
||||||
|
|
||||||
const ticketId = 1;
|
const ticketId = 1;
|
||||||
const result = await models.Ticket.getVolume(ticketId, options);
|
const result = await models.Ticket.getVolume(ticketId, options);
|
||||||
|
const saleVolume = result[0];
|
||||||
|
const packingTypeVolume = result[1];
|
||||||
|
|
||||||
expect(result[0].volume).toEqual(1.09);
|
expect(saleVolume).toBeDefined;
|
||||||
|
expect(packingTypeVolume).toBeDefined;
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue