#1462 updateVolume backTest
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-06-06 09:34:45 +02:00
parent 55ea445f02
commit f3558a2d26
1 changed files with 12 additions and 9 deletions

View File

@ -6,10 +6,13 @@ describe('route updateVolume()', () => {
const ctx = {req: {accessToken: {userId: workerFk}}};
let originalRoute;
let ticketRestore;
let logIdToDestroy;
afterAll(async done => {
await originalRoute.updateAttributes({m3: 0.2});
await ticketRestore.updateAttributes({routeFk: 4});
await app.models.RouteLog.destroyById(logIdToDestroy);
done();
});
@ -30,15 +33,15 @@ describe('route updateVolume()', () => {
expect(updatedRoute.m3).not.toEqual(originalRoute.m3);
});
// 1462
xit('should confirm the change is logged ', async() => {
let instanceValue = {m3: 0.3};
let filterValue = JSON.stringify(instanceValue);
let filter = {where: {newInstance: filterValue}};
console.log(filter);
let routeLog = await app.models.RouteLog.find(filter);
console.log(routeLog);
expect(routeLog.length).toBeGreaterThan(0);
it('should confirm the change is logged', async() => {
let instanceValue = {m3: 0.3};
let logs = await app.models.RouteLog.find({fields: ['id', 'newInstance']});
let m3Log = logs.filter(log => {
return log.newInstance.m3 === instanceValue.m3;
});
logIdToDestroy = m3Log[0].id;
expect(m3Log.length).toEqual(1);
});
});