Fix bug in subscriptions address controller where the country id lookup was not exact and states returned were incorrect. Add unit tests to cover different cases

This commit is contained in:
luisramos0
2018-10-16 17:30:57 +01:00
parent 590091c42a
commit feaf16d878
3 changed files with 54 additions and 7 deletions

View File

@@ -0,0 +1,30 @@
describe "ProvidersCtrl", ->
ctrl = null
scope = null
paymentMethod = null
describe "initialising using a payment method without a type", ->
beforeEach ->
module 'admin.paymentMethods'
scope = {}
paymentMethod =
type: null
inject ($controller)->
ctrl = $controller 'ProvidersCtrl', {$scope: scope, paymentMethod: paymentMethod }
it "sets the invlude_html porperty on scope to blank", ->
expect(scope.include_html).toBe ""
describe "initialising using a payment method with a type", ->
beforeEach ->
module 'admin.paymentMethods'
scope = {}
paymentMethod =
type: "NOT NULL"
inject ($controller)->
ctrl = $controller 'ProvidersCtrl', {$scope: scope, paymentMethod: paymentMethod }
it "sets the include_html porperty on scope to some address", ->
expect(scope.include_html).toBe "/admin/payment_methods/show_provider_preferences?provider_type=NOT NULL;pm_id=#{paymentMethod.id};"