test: refs #7225 fix back test
gitea/salix/pipeline/pr-master There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-04-24 10:42:50 +02:00
parent cc06698214
commit 0cd740ce0c
2 changed files with 5 additions and 8 deletions

View File

@ -118,7 +118,7 @@ module.exports = Self => {
const [salesMovable] = await Self.rawSql(query, params, myOptions); const [salesMovable] = await Self.rawSql(query, params, myOptions);
const itemMovable = new Map(); const itemMovable = new Map();
for (sale of salesMovable) { for (let sale of salesMovable) {
const saleMovable = sale.movable ? sale.movable : 0; const saleMovable = sale.movable ? sale.movable : 0;
itemMovable.set(sale.id, saleMovable); itemMovable.set(sale.id, saleMovable);
} }
@ -129,7 +129,7 @@ module.exports = Self => {
const [difComponents] = await Self.rawSql(query, params, myOptions); const [difComponents] = await Self.rawSql(query, params, myOptions);
const map = new Map(); const map = new Map();
for (difComponent of difComponents) for (let difComponent of difComponents)
map.set(difComponent.saleFk, difComponent); map.set(difComponent.saleFk, difComponent);
for (sale of salesObj.items) { for (sale of salesObj.items) {

View File

@ -1,5 +1,4 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
const UserError = require('vn-loopback/util/user-error');
const ForbiddenError = require('vn-loopback/util/forbiddenError'); const ForbiddenError = require('vn-loopback/util/forbiddenError');
describe('sale priceDifference()', () => { describe('sale priceDifference()', () => {
@ -83,12 +82,10 @@ describe('sale priceDifference()', () => {
warehouseId: 1 warehouseId: 1
}; };
const result = await models.Ticket.priceDifference(ctx, options); const {items} = await models.Ticket.priceDifference(ctx, options);
const firstItem = result.items[0];
const secondtItem = result.items[1];
expect(firstItem.movable).toEqual(380); expect(items[0].movable).toEqual(410);
expect(secondtItem.movable).toEqual(1790); expect(items[1].movable).toEqual(1810);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {