31 lines
821 B
JavaScript
31 lines
821 B
JavaScript
const {models} = require('vn-loopback');
|
|
|
|
describe('workerActivity insert()', () => {
|
|
const ctx = beforeAll.getCtx(1106);
|
|
|
|
it('should insert in workerActivity', async() => {
|
|
const tx = await models.WorkerActivity.beginTransaction({});
|
|
let count = 0;
|
|
const options = {transaction: tx};
|
|
|
|
try {
|
|
await models.WorkerActivityType.create(
|
|
{'code': 'STOP', 'description': 'STOP'}, options
|
|
);
|
|
|
|
await models.WorkerActivity.add(ctx, 'STOP', 'APP', options);
|
|
|
|
count = await models.WorkerActivity.count(
|
|
{'workerFK': 1106}, options
|
|
);
|
|
|
|
await tx.rollback();
|
|
} catch (e) {
|
|
await tx.rollback();
|
|
throw e;
|
|
}
|
|
|
|
expect(count).toEqual(1);
|
|
});
|
|
});
|