7743-simpleTestForSendMail #3170
|
@ -0,0 +1,20 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('sendMail', () => {
|
||||||
|
it('should insert in mail', async() => {
|
||||||
|
const ctx = {
|
||||||
|
req: {accessToken: {userId: 50}},
|
||||||
|
args: {workerFk: 1106, year: 2001, week: 1}
|
||||||
|
};
|
||||||
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
options.transaction = tx;
|
||||||
|
|
||||||
|
const mailCountBefore = await models.Mail.count(options);
|
||||||
|
await models.WorkerTimeControl.sendMail(ctx, options);
|
||||||
|
const mailCountAfter = await models.Mail.count(options);
|
||||||
|
|
||||||
|
expect(mailCountAfter).toBeGreaterThan(mailCountBefore);
|
||||||
|
await tx.rollback();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue