fix: test back
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3096738b84
commit
b5d2d53435
|
@ -17,7 +17,7 @@ describe('InvoiceOut refund()', () => {
|
|||
try {
|
||||
const result = await models.InvoiceOut.refund('T1111111', options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(result.length).toEqual(1);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
|
@ -97,7 +97,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
for (const sale of sales) {
|
||||
const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets);
|
||||
const refundTicketId = await getTicketRefundId(createSingleTicket, sale.ticketFk, refundTickets, mappedTickets);
|
||||
|
||||
const createdSale = await models.Sale.create({
|
||||
ticketFk: refundTicketId,
|
||||
|
@ -122,7 +122,7 @@ module.exports = Self => {
|
|||
const services = await models.TicketService.find(servicesFilter, myOptions);
|
||||
|
||||
for (const service of services) {
|
||||
const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets);
|
||||
const refundTicketId = await getTicketRefundId(createSingleTicket, service.ticketFk, refundTickets, mappedTickets);
|
||||
|
||||
await models.TicketService.create({
|
||||
description: service.description,
|
||||
|
@ -180,7 +180,7 @@ module.exports = Self => {
|
|||
}, myOptions);
|
||||
}
|
||||
|
||||
async function getTicketRefundId(createSingleTicket, ticketId, refundTickets) {
|
||||
async function getTicketRefundId(createSingleTicket, ticketId, refundTickets, mappedTickets) {
|
||||
if (createSingleTicket) {
|
||||
const [firstRefundTicket] = refundTickets;
|
||||
return firstRefundTicket.id;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('sale refund()', () => {
|
||||
describe('Sale refund()', () => {
|
||||
const userId = 5;
|
||||
const activeCtx = {
|
||||
accessToken: {userId: userId},
|
||||
|
@ -22,7 +22,7 @@ describe('sale refund()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const response = await models.Sale.refund(salesIds, servicesIds, options);
|
||||
const response = await models.Sale.refund(salesIds, servicesIds, false, options);
|
||||
|
||||
expect(response.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
|
@ -40,7 +40,8 @@ describe('sale refund()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const tickets = await models.Sale.refund(salesIds, servicesIds, options);
|
||||
const createSingleTicket = false;
|
||||
const tickets = await models.Sale.refund(salesIds, servicesIds, createSingleTicket, options);
|
||||
|
||||
const ticketsIds = tickets.map(ticket => ticket.id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue