~singpolyma/sgx-jmp

22b1197950d1d80422c61982f060ae0c20c87a8c — Stephen Paul Weber 2 years ago b4391f1
Fix sentry issue SGX-JMP-4

Typo not caught by tests because this method had none.  Add a test, fix the typo.
2 files changed, 17 insertions(+), 1 deletions(-)

M lib/buy_account_credit_form.rb
M test/test_buy_account_credit_form.rb
M lib/buy_account_credit_form.rb => lib/buy_account_credit_form.rb +1 -1
@@ 4,7 4,7 @@ require_relative "./xep0122_field"

class BuyAccountCreditForm
	def self.for(customer)
		@customer.payment_methods.then do |payment_methods|
		customer.payment_methods.then do |payment_methods|
			new(customer.balance, payment_methods)
		end
	end

M test/test_buy_account_credit_form.rb => test/test_buy_account_credit_form.rb +16 -0
@@ 4,6 4,8 @@ require "test_helper"
require "buy_account_credit_form"
require "customer"

Customer::BRAINTREE = Minitest::Mock.new

class BuyAccountCreditFormTest < Minitest::Test
	def setup
		@payment_method = OpenStruct.new(card_type: "Test", last_4: "1234")


@@ 13,6 15,20 @@ class BuyAccountCreditFormTest < Minitest::Test
		)
	end

	def test_for
		braintree_customer = Minitest::Mock.new
		Customer::BRAINTREE.expect(:customer, braintree_customer)
		braintree_customer.expect(:find, EMPromise.resolve(
			OpenStruct.new(payment_methods: [])
		), ["test"])

		assert_kind_of(
			BuyAccountCreditForm,
			BuyAccountCreditForm.for(Customer.new("test")).sync
		)
	end
	em :test_for

	def test_balance
		assert_equal(
			{ type: "fixed", value: "Current balance: $12.12" },