feat: refs #7936 add tests for invoiceIn filter
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-11-29 17:05:13 +01:00
parent 59b5dd5a36
commit 00085f2b99
2 changed files with 18 additions and 1 deletions

View File

@ -166,4 +166,21 @@ describe('InvoiceIn filter()', () => {
throw e;
}
});
it('should return the invoice in matching companyFk', async() => {
const tx = await models.InvoiceIn.beginTransaction({});
const options = {transaction: tx};
try {
const company = await models.Company.findOne({}, options);
const invoicesByCompany = await models.InvoiceIn.find({where: {companyFk: company.id}}, options);
const filteredInvoices = await models.InvoiceIn.filter({args: {companyFk: company.id}}, {}, options);
expect(filteredInvoices.length).toEqual(invoicesByCompany.length);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -1,6 +1,6 @@
const models = require('vn-loopback/server/server').models;
fdescribe('invoiceIn', () => {
describe('invoiceIn', () => {
let options;
let tx;
const invoiceId = 1;