Automatically select the customer's default card in the checkout

This commit is contained in:
Rob Harrington
2018-05-04 09:19:57 +10:00
parent e88e963b4c
commit 254f0db97c
3 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
describe "PaymentCtrl", ->
ctrl = null
scope = null
card1 = { id: 1, is_default: false }
card2 = { id: 3, is_default: true }
cards = [card1, card2]
beforeEach ->
module("Darkswarm")
angular.module('Darkswarm').value('savedCreditCards', cards)
inject ($controller, $rootScope) ->
scope = $rootScope.$new()
scope.secrets = {}
ctrl = $controller 'PaymentCtrl', {$scope: scope}
it "sets the default card id as the selected_card", ->
expect(scope.secrets.selected_card).toEqual card2.id