mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-23 01:03:21 +00:00
When BOM is 'item', do not update sumOfUnitValues with scale
since scale is always `1`, but return a value + update tests as well
This commit is contained in:
@@ -207,13 +207,7 @@ describe "LineItemsCtrl", ->
|
||||
scope.selectedUnitsProduct = { variant_unit: "weight" }
|
||||
expect(scope.fulfilled()).toEqual ''
|
||||
|
||||
it "returns '', and does not call Math.round if variant_unit is 'items'", ->
|
||||
spyOn(Math,"round")
|
||||
scope.selectedUnitsProduct = { variant_unit: "items", group_buy_unit_size: 10 }
|
||||
expect(scope.fulfilled()).toEqual ''
|
||||
expect(Math.round).not.toHaveBeenCalled()
|
||||
|
||||
it "calls Math.round() if variant_unit is 'weight' or 'volume'", ->
|
||||
it "calls Math.round() if variant_unit is 'weight', 'volume', or items", ->
|
||||
spyOn(Math,"round")
|
||||
scope.selectedUnitsProduct = { variant_unit: "weight", group_buy_unit_size: 10 }
|
||||
scope.fulfilled()
|
||||
@@ -221,6 +215,9 @@ describe "LineItemsCtrl", ->
|
||||
scope.selectedUnitsProduct = { variant_unit: "volume", group_buy_unit_size: 10 }
|
||||
scope.fulfilled()
|
||||
expect(Math.round).toHaveBeenCalled()
|
||||
scope.selectedUnitsProduct = { variant_unit: "items", group_buy_unit_size: 10 }
|
||||
scope.fulfilled()
|
||||
expect(Math.round).toHaveBeenCalled()
|
||||
|
||||
|
||||
describe "returns the quantity of fulfilled group buy units", ->
|
||||
|
||||
Reference in New Issue
Block a user