feat: add backTest
gitea/salix/pipeline/head This commit is unstable
Details
gitea/salix/pipeline/head This commit is unstable
Details
This commit is contained in:
parent
51bd18ac37
commit
979ee1d956
|
@ -0,0 +1,51 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('route updateWorkCenter()', () => {
|
||||
const routeId = 1;
|
||||
|
||||
it('should update the commissionWorkCenterFk from workerLabour.workCenterFK', async() => {
|
||||
const tx = await models.Defaulter.beginTransaction({});
|
||||
try {
|
||||
const developerId = 9;
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: developerId}
|
||||
}
|
||||
};
|
||||
const options = {transaction: tx};
|
||||
|
||||
const expectedResult = 1;
|
||||
const updatedRoute = await models.Route.updateWorkCenter(ctx, routeId, options);
|
||||
|
||||
expect(updatedRoute.commissionWorkCenterFk).toEqual(expectedResult);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should update the commissionWorkCenterFk from defaultWorkCenterFk if workerLabour.workCenterFK is null', async() => {
|
||||
const tx = await models.Defaulter.beginTransaction({});
|
||||
try {
|
||||
const noExistentId = 2;
|
||||
const ctx = {
|
||||
req: {
|
||||
accessToken: {userId: noExistentId}
|
||||
}
|
||||
};
|
||||
const options = {transaction: tx};
|
||||
|
||||
const expectedResult = 9;
|
||||
const updatedRoute = await models.Route.updateWorkCenter(ctx, routeId, options);
|
||||
|
||||
expect(updatedRoute.commissionWorkCenterFk).toEqual(expectedResult);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue