test new uses transaction
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-04-28 11:24:02 +02:00
parent ddc19ddbcd
commit e53298f35c
1 changed files with 12 additions and 2 deletions

View File

@ -14,10 +14,20 @@ describe('sale deleteBuys()', () => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
const tx = await app.models.Entry.beginTransaction({});
const options = {transaction: tx};
ctx.args = {buys: [{id: 1}]};
let result = await app.models.Buy.deleteBuys(ctx);
try {
const result = await app.models.Buy.deleteBuys(ctx, options);
expect(result).toEqual([{count: 1}]);
expect(result).toEqual([{count: 1}]);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});