Multiply by unit_value as sumOfUnitValues is now scaled

This commit is contained in:
Jean-Baptiste Bellet
2021-12-07 10:59:49 +01:00
parent b746eacd11
commit 515e2cfc51
2 changed files with 7 additions and 1 deletions

View File

@@ -171,8 +171,14 @@ describe "LineItemsCtrl", ->
it "returns the quantity of fulfilled group buy units", ->
scope.selectedUnitsProduct = { variant_unit: "weight", group_buy_unit_size: 1000 }
scope.selectedUnitsVariant = { unit_value: 1 }
expect(scope.fulfilled(1500)).toEqual 1.5
it "returns the quantity of fulfilled group buy units by volume", ->
scope.selectedUnitsProduct = { variant_unit: "volume", group_buy_unit_size: 5000 }
scope.selectedUnitsVariant = { unit_value: 1000 }
expect(scope.fulfilled(5)).toEqual 1
describe "allFinalWeightVolumesPresent()", ->
it "returns false if the unit_value of any item in filteredLineItems does not exist", ->
scope.filteredLineItems = [