mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-23 01:03:21 +00:00
Mock bigDecimal methods in specs
This commit is contained in:
@@ -517,6 +517,10 @@ describe "AdminProductEditCtrl", ->
|
||||
|
||||
describe "submitting products to be updated", ->
|
||||
describe "packing products", ->
|
||||
beforeEach ->
|
||||
window.bigDecimal = jasmine.createSpyObj "bigDecimal", ["multiply"]
|
||||
window.bigDecimal.multiply.and.callFake (a, b, c) -> (a * b).toFixed(c)
|
||||
|
||||
it "extracts variant_unit_with_scale into variant_unit and variant_unit_scale", ->
|
||||
testProduct =
|
||||
id: 1
|
||||
@@ -589,6 +593,8 @@ describe "AdminProductEditCtrl", ->
|
||||
|
||||
beforeEach ->
|
||||
BulkProducts.products = [testProduct]
|
||||
window.bigDecimal = jasmine.createSpyObj "bigDecimal", ["multiply"]
|
||||
window.bigDecimal.multiply.and.callFake (a, b, c) -> (a * b).toFixed(c)
|
||||
|
||||
it "extracts unit_value and unit_description from unit_value_with_description", ->
|
||||
testProduct = {id: 123, variant_unit_scale: 1.0}
|
||||
|
||||
@@ -3,6 +3,8 @@ describe "BulkProducts service", ->
|
||||
|
||||
beforeEach ->
|
||||
module "ofn.admin"
|
||||
window.bigDecimal = jasmine.createSpyObj "bigDecimal", ["round"]
|
||||
window.bigDecimal.round.and.callFake (a, b) -> a.toFixed(b)
|
||||
|
||||
beforeEach inject (_BulkProducts_, _$httpBackend_) ->
|
||||
BulkProducts = _BulkProducts_
|
||||
|
||||
Reference in New Issue
Block a user