Merge pull request #9506 from binarygit/remove-angular-from-payment-methods

Remove angular from payment methods
This commit is contained in:
Rachel Arnould
2022-10-11 13:13:26 +02:00
committed by GitHub
6 changed files with 3 additions and 76 deletions

View File

@@ -13,8 +13,6 @@ describe "enterpriseCtrl", ->
sells: "none"
owner:
id: 98
PaymentMethods =
paymentMethods: "payment methods"
receivesNotifications = 99
inject ($rootScope, $controller, _Enterprises_, _StatusMessage_) ->
@@ -27,9 +25,6 @@ describe "enterpriseCtrl", ->
it "stores enterprise", ->
expect(scope.Enterprise).toEqual enterprise
it "stores payment methods", ->
expect(scope.PaymentMethods).toBe PaymentMethods.paymentMethods
describe "removing logo", ->
deferred = null

View File

@@ -1,44 +0,0 @@
describe "EnterprisePaymentMethods service", ->
enterprise = null
PaymentMethods = null
EnterprisePaymentMethods = null
beforeEach ->
enterprise =
payment_method_ids: [ 1, 3 ]
PaymentMethods =
all: [ { id: 1 }, { id: 2 }, { id: 3 }, { id: 4 } ]
module 'admin.enterprises'
module ($provide) ->
$provide.value 'PaymentMethods', PaymentMethods
$provide.value 'enterprise', enterprise
null
inject (_EnterprisePaymentMethods_) ->
EnterprisePaymentMethods = _EnterprisePaymentMethods_
describe "selecting payment methods", ->
it "sets the selected property of each payment method", ->
expect(PaymentMethods.all[0].selected).toBe true
expect(PaymentMethods.all[1].selected).toBe false
expect(PaymentMethods.all[2].selected).toBe true
expect(PaymentMethods.all[3].selected).toBe false
describe "determining payment method colour", ->
it "returns 'blue' when at least one payment method is selected", ->
spyOn(EnterprisePaymentMethods, "selectedCount").and.returnValue 1
expect(EnterprisePaymentMethods.displayColor()).toBe "blue"
it "returns 'red' when no payment methods are selected", ->
spyOn(EnterprisePaymentMethods, "selectedCount").and.returnValue 0
expect(EnterprisePaymentMethods.displayColor()).toBe "red"
it "returns 'red' when no payment methods exist", ->
EnterprisePaymentMethods.paymentMethods = []
spyOn(EnterprisePaymentMethods, "selectedCount").and.returnValue 1
expect(EnterprisePaymentMethods.displayColor()).toBe "red"
describe "counting selected payment methods", ->
it "counts only payment methods with selected: true", ->
expect(EnterprisePaymentMethods.selectedCount()).toBe 2