salix/services/db/tests/vn/logAddWithUser.spec.js

32 lines
940 B
JavaScript
Raw Normal View History

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);
});
});