2022-11-03 14:00:55 +00:00
|
|
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
|
|
|
const models = require('vn-loopback/server/server').models;
|
|
|
|
|
2022-11-04 12:41:45 +00:00
|
|
|
fdescribe('workerTimeControl sendMail()', () => {
|
|
|
|
const workerId = 18;
|
|
|
|
const ctx = {
|
|
|
|
req: {
|
|
|
|
__: value => {
|
|
|
|
return value;
|
2022-11-03 14:00:55 +00:00
|
|
|
}
|
2022-11-04 12:41:45 +00:00
|
|
|
},
|
|
|
|
args: {}
|
2022-11-03 14:00:55 +00:00
|
|
|
|
2022-11-04 12:41:45 +00:00
|
|
|
};
|
2022-11-03 14:00:55 +00:00
|
|
|
|
2022-11-04 12:41:45 +00:00
|
|
|
it('should...', async() => {
|
|
|
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
2022-11-03 14:00:55 +00:00
|
|
|
|
2022-11-04 12:41:45 +00:00
|
|
|
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');
|
2022-11-03 14:00:55 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|