Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-06-06 09:48:46 +02:00
commit 7a44a5aab8
1 changed files with 12 additions and 9 deletions

View File

@ -6,10 +6,13 @@ describe('route updateVolume()', () => {
const ctx = {req: {accessToken: {userId: workerFk}}}; const ctx = {req: {accessToken: {userId: workerFk}}};
let originalRoute; let originalRoute;
let ticketRestore; let ticketRestore;
let logIdToDestroy;
afterAll(async done => { afterAll(async done => {
await originalRoute.updateAttributes({m3: 0.2}); await originalRoute.updateAttributes({m3: 0.2});
await ticketRestore.updateAttributes({routeFk: 4}); await ticketRestore.updateAttributes({routeFk: 4});
await app.models.RouteLog.destroyById(logIdToDestroy);
done(); done();
}); });
@ -30,15 +33,15 @@ describe('route updateVolume()', () => {
expect(updatedRoute.m3).not.toEqual(originalRoute.m3); 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);
}); });
}); });