const models = require('vn-loopback/server/server').models; describe('workerTimeControl getMailStates()', () => { const workerId = 9; const ctx = {args: { month: 12, year: 2000 }}; it('should get the states of a month about time control mail', async() => { const tx = await models.WorkerTimeControl.beginTransaction({}); try { const options = {transaction: tx}; const response = await models.WorkerTimeControl.getMailStates(ctx, workerId, options); expect(response[0].state).toEqual('REVISE'); expect(response[1].state).toEqual('SENDED'); expect(response[2].state).toEqual('CONFIRMED'); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); });