From 87e4765a1cf5cb4adcd565722c30aa2039d887e4 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 22 Sep 2020 16:53:47 +0200 Subject: [PATCH 1/3] fixed ticket-weekly backend unit test --- .../back/methods/route/specs/updateVolume.spec.js | 1 - .../back/methods/ticket-weekly/specs/filter.spec.js | 10 ++++++---- .../back/methods/ticket/specs/priceDifference.spec.js | 1 - .../back/methods/ticket/specs/setDeleted.spec.js | 2 +- .../methods/ticket/specs/updateEditableTicket.spec.js | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js index a1ff67acc..3b4d51df7 100644 --- a/modules/route/back/methods/route/specs/updateVolume.spec.js +++ b/modules/route/back/methods/route/specs/updateVolume.spec.js @@ -8,7 +8,6 @@ describe('route updateVolume()', () => { let ticketToRestore; let logIdToDestroy; - afterAll(async done => { await originalRoute.updateAttributes({m3: 1.8}); await ticketToRestore.updateAttributes({routeFk: null}); diff --git a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js index 14729b094..e600fbfa9 100644 --- a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js @@ -2,13 +2,15 @@ const app = require('vn-loopback/server/server'); describe('ticket-weekly filter()', () => { const authUserId = 9; - it('should return the tickets matching the filter', async() => { - const ctx = {req: {accessToken: {userId: authUserId}}, args: {}}; - const filter = {order: 'id DESC'}; - const result = await app.models.TicketWeekly.filter(ctx, filter); + it('should all return the tickets matching the filter', async() => { + const filter = {order: 't.id ASC'}; + const ctx = {req: {accessToken: {userId: authUserId}}, args: {filter: filter}}; + const result = await app.models.TicketWeekly.filter(ctx); + const firstRow = result[0]; expect(firstRow.ticketFk).toEqual(1); + expect(result.length).toEqual(5); }); it('should return the ticket with id one', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index bf61524c7..ea634a499 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -35,7 +35,6 @@ describe('sale priceDifference()', () => { error = e; }); - expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`)); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 0a73ad322..518b6a4d8 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -25,7 +25,7 @@ describe('ticket setDeleted()', () => { expect(error.message).toEqual('You must delete the claim id %d first'); }); - it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get ride of the itemshelving', async() => { + it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => { const employeeUser = 110; const ctx = { req: { diff --git a/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js b/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js index 16d8d1edb..a08565df2 100644 --- a/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js @@ -26,7 +26,6 @@ describe('ticket updateEditableTicket()', () => { expect(error).toBeDefined(); }); - it('should edit the ticket address', async() => { let ctx = {req: {accessToken: {userId: 9}}}; From 40abd68734befa45e3539f0511d7d31b838c49dc Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 29 Sep 2020 13:11:11 +0200 Subject: [PATCH 2/3] fix byWarehouse and ticket.filter tests --- .../back/methods/ticket/specs/filter.spec.js | 3 +- .../agency-mode/specs/byWarehouse.spec.js | 1 - .../methods/zone/specs/deleteZone.spec.js | 21 +++++-- package-lock.json | 58 +++++++++---------- 4 files changed, 46 insertions(+), 37 deletions(-) diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index b88f0666a..85b410671 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -63,8 +63,7 @@ describe('ticket filter()', () => { expect(firstRow.id).toEqual(11); }); - // #2456 fix ticket.filter unit test - xit('should return the tickets with grouped state "Pending" and not "Ok"', async() => { + it('should return the tickets with grouped state "Pending" and not "Ok" nor "BOARDING"', async() => { const ctx = {req: {accessToken: {userId: 9}}, args: {pending: true}}; const filter = {}; const result = await app.models.Ticket.filter(ctx, filter); diff --git a/modules/zone/back/methods/agency-mode/specs/byWarehouse.spec.js b/modules/zone/back/methods/agency-mode/specs/byWarehouse.spec.js index a2c2ca592..a40a1904a 100644 --- a/modules/zone/back/methods/agency-mode/specs/byWarehouse.spec.js +++ b/modules/zone/back/methods/agency-mode/specs/byWarehouse.spec.js @@ -12,7 +12,6 @@ describe('AgencyMode byWarehhouse()', () => { it('should return only the agencies for a warehouse', async() => { const where = {warehouseFk: warehouseId}; const agencies = await app.models.AgencyMode.byWarehouse({where}); - const validWarehouse = agencies.every(agency => agency.warehouseFk = warehouseId); expect(agencies.length).toEqual(6); diff --git a/modules/zone/back/methods/zone/specs/deleteZone.spec.js b/modules/zone/back/methods/zone/specs/deleteZone.spec.js index d8fa3efc1..c7f4cb939 100644 --- a/modules/zone/back/methods/zone/specs/deleteZone.spec.js +++ b/modules/zone/back/methods/zone/specs/deleteZone.spec.js @@ -4,6 +4,7 @@ describe('zone deletezone()', () => { let zoneId = 9; let originalZoneTickets; let originalZone; + let originalZoneWarehouses; let originalZoneIncluded; let ticketsId; let originalTicketsState; @@ -11,6 +12,7 @@ describe('zone deletezone()', () => { beforeAll(async done => { originalZone = await app.models.Zone.findById(zoneId); originalZoneTickets = await app.models.Ticket.find({where: {zoneFk: zoneId}}); + originalZoneWarehouses = await app.models.ZoneWarehouse.findById(zoneId); originalZoneIncluded = await app.models.ZoneIncluded.find({where: {zoneFk: zoneId}}); ticketsId = originalZoneTickets.map(originalZoneTickets => originalZoneTickets.id); originalTicketsState = await app.models.TicketState.find({where: { @@ -21,13 +23,23 @@ describe('zone deletezone()', () => { afterAll(async done => { await originalZone.save(); + await app.models.ZoneWarehouse.create(originalZoneWarehouses); - originalZoneTickets.forEach(async ticket => { + for (ticket of originalZoneTickets) await ticket.updateAttributes({zoneFk: zoneId}); - }); - originalZoneIncluded.forEach(async zoneIncluded => { + + for (zoneIncluded of originalZoneIncluded) await zoneIncluded.save(); - }); + + const fixingStateId = 1; + const ticketIds = originalZoneTickets.map(ticket => ticket.id); + const trackings = await app.models.TicketTracking.find({where: { + ticketFk: {inq: ticketIds}, + stateFk: fixingStateId}}); + + for (let tracking of trackings) + await app.models.TicketTracking.destroyById(tracking.id); + done(); }); @@ -48,4 +60,3 @@ describe('zone deletezone()', () => { expect(originalTicketsState.length).not.toBeGreaterThan(updatedTicketState.length); }); }); - diff --git a/package-lock.json b/package-lock.json index f0ae74065..a333fb9fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5835,7 +5835,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -6806,7 +6806,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -7127,7 +7127,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -7187,7 +7187,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "requires": { "base64-js": "^1.0.2", @@ -7329,7 +7329,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -7399,7 +7399,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -7543,7 +7543,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -8703,7 +8703,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -9796,7 +9796,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -10982,7 +10982,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -11019,7 +11019,7 @@ }, "globby": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { @@ -13177,7 +13177,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=" }, "is-path-cwd": { @@ -13207,7 +13207,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -18645,7 +18645,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -19588,7 +19588,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "mem": { @@ -19613,7 +19613,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -20068,7 +20068,7 @@ }, "multipipe": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { @@ -21027,7 +21027,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -21043,7 +21043,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -22227,7 +22227,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -22620,7 +22620,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -22834,7 +22834,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -23295,7 +23295,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -23346,7 +23346,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -23630,7 +23630,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -24735,7 +24735,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { @@ -24941,7 +24941,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", + "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", "dev": true, "requires": { "nopt": "~1.0.10" @@ -25023,7 +25023,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", "dev": true }, @@ -26733,7 +26733,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "xmlchars": { From 1e55632b940e1bad01e42c3c24ae4583119b5926 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 29 Sep 2020 13:28:02 +0200 Subject: [PATCH 3/3] refactor & fix regularize claim and prices Diff --- .../back/methods/claim/specs/regularizeClaim.spec.js | 9 +++------ .../back/methods/ticket/specs/priceDifference.spec.js | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 3098be157..55189bd9a 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,7 +1,6 @@ const app = require('vn-loopback/server/server'); -// #2457 fix regularizeClaim unit test -xdescribe('regularizeClaim()', () => { +describe('regularizeClaim()', () => { const claimFk = 1; const pendentState = 1; const resolvedState = 3; @@ -26,7 +25,6 @@ xdescribe('regularizeClaim()', () => { done(); }); - // #2457 fix regularizeClaim unit test (this one fails) it('should send a chat message with value "Trash" and then change claim state to resolved', async() => { const ctx = { req: { @@ -46,9 +44,8 @@ xdescribe('regularizeClaim()', () => { ticketFk: 1 }); - claimEnds.forEach(async claimEnd => { - claimEnd.updateAttributes({claimDestinationFk: trashDestination}); - }); + for (claimEnd of claimEnds) + await claimEnd.updateAttributes({claimDestinationFk: trashDestination}); let claimBefore = await app.models.Claim.findById(claimFk); await app.models.Claim.regularizeClaim(ctx, claimFk); diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index ea634a499..062be6b22 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -17,8 +17,7 @@ describe('sale priceDifference()', () => { let result = await app.models.Ticket.priceDifference(httpCtx, ticketId, landed, addressId, agencyModeId, zoneId, warehouseId); - expect(result.totalUnitPrice).toEqual(215.78); - expect(result.totalNewPrice).toEqual(215.78); + expect(result.totalUnitPrice).toEqual(result.totalNewPrice); expect(result.totalDifference).toEqual(0); });