diff --git a/db/versions/11350-silverArborvitae/00-firstScript.sql b/db/versions/11350-silverArborvitae/00-firstScript.sql new file mode 100644 index 000000000..b5e87133e --- /dev/null +++ b/db/versions/11350-silverArborvitae/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.shelvingLog + MODIFY COLUMN changedModel enum('Shelving', 'ItemShelving') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Shelving' NOT NULL; diff --git a/modules/worker/back/methods/worker-time-control/specs/login.spec.js b/modules/worker/back/methods/worker-time-control/specs/login.spec.js index e125a876d..eff0edaa7 100644 --- a/modules/worker/back/methods/worker-time-control/specs/login.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/login.spec.js @@ -1,5 +1,4 @@ const models = require('vn-loopback/server/server').models; -const LoopBackContext = require('loopback-context'); const UserError = require('vn-loopback/util/user-error'); describe('workerTimeControl login()', () => { diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js new file mode 100644 index 000000000..1395c7a46 --- /dev/null +++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js @@ -0,0 +1,27 @@ +const models = require('vn-loopback/server/server').models; + +describe('sendMail', () => { + it('should insert in mail', async() => { + const tx = await models.Sale.beginTransaction({}); + const options = {transaction: tx}; + options.transaction = tx; + let mailCountBefore; + let mailCountAfter; + const ctx = { + req: {accessToken: {userId: 50}}, + args: {workerFk: 1106, year: 2001, week: 1} + }; + + try { + mailCountBefore = await models.Mail.count(options); + await models.WorkerTimeControl.sendMail(ctx, options); + mailCountAfter = await models.Mail.count(options); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(mailCountAfter).toBeGreaterThan(mailCountBefore); + await tx.rollback(); + }); +});