get worked hours unit test
This commit is contained in:
parent
41d0c1e9bf
commit
0f7ed5bbfa
|
@ -35,7 +35,6 @@ module.exports = Self => {
|
|||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await conn.executeStmt(sql);
|
||||
|
||||
|
||||
return result[1];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('Worker getWorkedHours()', () => {
|
||||
it(`should return the expected hours and the worked hours of a given date`, async() => {
|
||||
const workerID = 106;
|
||||
let started = new Date();
|
||||
started.setHours(0, 0, 0, 0);
|
||||
|
||||
let ended = new Date();
|
||||
ended.setHours(0, 0, 0, 0);
|
||||
|
||||
const [result] = await app.models.Worker.getWorkedHours(workerID, started, ended);
|
||||
|
||||
expect(result.expectedHours).toEqual(28800); // 8:00 hours seconds
|
||||
expect(result.workedHours).toEqual(29400); // 8:10 hours in seconds
|
||||
});
|
||||
});
|
|
@ -44,7 +44,6 @@ module.exports = Self => {
|
|||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await conn.executeStmt(sql);
|
||||
|
||||
|
||||
return result[0];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue