mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Adding tests and views to handle changing shipping prices
This commit is contained in:
@@ -46,3 +46,36 @@ describe 'All controllers', ->
|
||||
scope = {}
|
||||
ctrl = $controller 'OrderCycleCtrl', {$scope: scope}
|
||||
|
||||
describe "CheckoutCtrl", ->
|
||||
ctrl = null
|
||||
scope = null
|
||||
order = null
|
||||
|
||||
beforeEach ->
|
||||
module("Checkout")
|
||||
order =
|
||||
id: 3102
|
||||
shipping_method_id: "7"
|
||||
ship_address_same_as_billing: true
|
||||
payment_method_id: null
|
||||
shipping_methods:
|
||||
7:
|
||||
require_ship_address: true
|
||||
price: 0.0
|
||||
|
||||
25:
|
||||
require_ship_address: false
|
||||
price: 13
|
||||
inject ($controller) ->
|
||||
scope = {}
|
||||
ctrl = $controller 'CheckoutCtrl', {$scope: scope, order: order}
|
||||
|
||||
|
||||
it 'Gets the ship address automatically', ->
|
||||
expect(scope.require_ship_address).toEqual true
|
||||
|
||||
it 'Gets the current shipping price', ->
|
||||
expect(scope.shippingPrice()).toEqual 0.0
|
||||
scope.order.shipping_method_id = 25
|
||||
expect(scope.shippingPrice()).toEqual 13
|
||||
|
||||
|
||||
Reference in New Issue
Block a user