#685 PROCEDURE unit test vn.logAddWithUser
This commit is contained in:
parent
8ce2912344
commit
146f3c8139
|
@ -121,6 +121,7 @@ module.exports = Self => {
|
|||
insertIntoClaimEnd(createdSales, id, worker.id, {transaction: transaction});
|
||||
await Self.rawSql('CALL vn.ticketCalculateClon(?)', [newRefundTicket], {transaction: transaction});
|
||||
await transaction.commit();
|
||||
return newRefundTicket;
|
||||
} catch (e) {
|
||||
await transaction.rollback();
|
||||
throw e;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
const app = require(`../../../ticket/server/server`);
|
||||
|
||||
describe('logAddWithUser()', () => {
|
||||
it('should log any action taken by the user in a table ending in Log', async() => {
|
||||
let params = {
|
||||
ticketFk: 1,
|
||||
userId: 9,
|
||||
actionCode: 'update',
|
||||
targetEntity: 'ticket',
|
||||
description: 'we are testing stuff'
|
||||
};
|
||||
|
||||
let query = `
|
||||
START TRANSACTION;
|
||||
CALL vn.logAddWithUser(?, ?, ?, ?, ?);
|
||||
SELECT * FROM vn.ticketLog WHERE description = ?;
|
||||
ROLLBACK;`;
|
||||
let result = await app.models.Ticket.rawSql(query, [
|
||||
params.ticketFk,
|
||||
params.userId,
|
||||
params.actionCode,
|
||||
params.targetEntity,
|
||||
params.description,
|
||||
params.description
|
||||
]);
|
||||
|
||||
savedDescription = result[2][0].description;
|
||||
|
||||
expect(savedDescription).toEqual(params.description);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue