salix/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js

36 lines
928 B
JavaScript

/* eslint max-len: ["error", { "code": 150 }]*/
const models = require('vn-loopback/server/server').models;
fdescribe('workerTimeControl sendMail()', () => {
const workerId = 18;
const ctx = {
req: {
__: value => {
return value;
}
},
args: {}
};
it('should...', async() => {
const tx = await models.WorkerTimeControl.beginTransaction({});
try {
const options = {transaction: tx};
await models.WorkerTimeControl.sendMail(ctx, options);
const workerTimeControl = await models.WorkerTimeControl.find({
where: {userFk: workerId}
}, options);
console.log(workerTimeControl);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
expect(result[1]).toEqual('text/plain');
});
});