7383-testToMaster #2445

Merged
alexm merged 233 commits from 7383-testToMaster into master 2024-05-14 05:44:13 +00:00
2 changed files with 7 additions and 28 deletions
Showing only changes of commit f7cdbd39f0 - Show all commits

View File

@ -139,12 +139,17 @@ BEGIN
SET vIsError = TRUE; SET vIsError = TRUE;
END IF; END IF;
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
IF vIsError THEN IF vIsError THEN
SET vErrorCode = 'WRONG_DIRECTION'; SET vErrorCode = 'WRONG_DIRECTION';
IF(SELECT option1 IS NULL AND option2 IS NULL
FROM tmp.workerTimeControlDirection) THEN
SET vErrorCode = 'DAY_MAX_TIME';
END IF;
CALL util.throw(vErrorCode); CALL util.throw(vErrorCode);
END IF; END IF;
DROP TEMPORARY TABLE tmp.workerTimeControlDirection;
-- FICHADAS IMPARES -- FICHADAS IMPARES
SELECT timed INTO vLastIn SELECT timed INTO vLastIn
FROM workerTimeControl FROM workerTimeControl

View File

@ -1,6 +1,5 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context'); const LoopBackContext = require('loopback-context');
const { async } = require('regenerator-runtime');
describe('workerTimeControl clockIn()', () => { describe('workerTimeControl clockIn()', () => {
const workerId = 9; const workerId = 9;
@ -47,31 +46,6 @@ describe('workerTimeControl clockIn()', () => {
} }
}); });
it('should throw an error trying to change a middle hour to out not resting 12h', async() => {
activeCtx.accessToken.userId = HHRRId;
const workerId = teamBossId;
const tx = await models.WorkerTimeControl.beginTransaction({});
try {
const options = {transaction: tx};
const entryTime = "2000-12-25T11:00:00.000Z";
ctx.args = {timed: entryTime, direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
const middleTime ="2000-12-26T11:00:00.000Z";
ctx.args = {timed: middleTime, direction: 'middle'};
const middleEntryTime = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
const direction = 'out';
await models.WorkerTimeControl.updateTimeEntry(ctx, middleEntryTime.id, direction, options);
await tx.rollback();
} catch (e) {
expect(e.message).toBe('Superado el tiempo máximo entre entrada y salida');
await tx.rollback();
}
});
it('should updates the time entry direction and remaining not be manual', async() => { it('should updates the time entry direction and remaining not be manual', async() => {
activeCtx.accessToken.userId = HHRRId; activeCtx.accessToken.userId = HHRRId;
const workerId = teamBossId; const workerId = teamBossId;