feat: refs #7936 add tests for invoiceIn filter
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
59b5dd5a36
commit
00085f2b99
|
@ -166,4 +166,21 @@ describe('InvoiceIn filter()', () => {
|
||||||
throw e;
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
fdescribe('invoiceIn', () => {
|
describe('invoiceIn', () => {
|
||||||
let options;
|
let options;
|
||||||
let tx;
|
let tx;
|
||||||
const invoiceId = 1;
|
const invoiceId = 1;
|
||||||
|
|
Loading…
Reference in New Issue