feat: add 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
b3263fb97e
commit
ca40eee5ad
|
@ -0,0 +1,30 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Client updatePortfolio', () => {
|
||||
const salesPersonId = 18;
|
||||
const clienId = 1108;
|
||||
it('should update the portfolioWeight', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const expectedResult = 841.63;
|
||||
|
||||
const client = await models.Client.findById(clienId, null, options);
|
||||
// await client.updateAttribute('salesPersonFk', 18);
|
||||
await models.Client.rawSql(`UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clienId}; `);
|
||||
|
||||
await models.Client.updatePortfolio();
|
||||
|
||||
let [vendedores] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.vendedores WHERE Id_Trabajador = ${salesPersonId}; `, null, options);
|
||||
|
||||
expect(vendedores.portfolioWeight).toEqual(expectedResult);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -53,11 +53,11 @@ describe('order filter()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const filter = {where: {'o.confirmed': false, 'c.salesPersonFk': 18}};
|
||||
const filter = {where: {'o.confirmed': false, 'c.salesPersonFk': 9}};
|
||||
const result = await models.Order.filter(myCtx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(9);
|
||||
expect(result[0].id).toEqual(7);
|
||||
expect(result.length).toEqual(4);
|
||||
expect(result[0].id).toEqual(19);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue