fix tests

Phillip Davis created

Change summary

test/test_customer.rb     | 18 ++++++++++++++++++
test/test_registration.rb |  4 ++--
2 files changed, 20 insertions(+), 2 deletions(-)

Detailed changes

test/test_customer.rb 🔗

@@ -13,6 +13,7 @@ CustomerUsage::REDIS = Minitest::Mock.new
 CustomerUsage::DB = Minitest::Mock.new
 CustomerFinancials::REDIS = Minitest::Mock.new
 CustomerFinancials::ELECTRUM = Minitest::Mock.new
+CustomerFinancials::ELECTRUM_BCH = Minitest::Mock.new
 CustomerFinancials::BRAINTREE = Minitest::Mock.new
 
 class CustomerTest < Minitest::Test
@@ -283,4 +284,21 @@ class CustomerTest < Minitest::Test
 		assert_mock CustomerFinancials::ELECTRUM
 	end
 	em :test_add_btc_address
+
+	def test_add_bch_address
+		CustomerFinancials::REDIS.expect(
+			:spopsadd,
+			EMPromise.resolve("testaddr"),
+			[["jmp_available_bch_addresses", "jmp_customer_bch_addresses-test"]]
+		)
+		CustomerFinancials::ELECTRUM_BCH.expect(
+			:notify,
+			EMPromise.resolve(nil),
+			["testaddr", "http://notify.example.com"]
+		)
+		assert_equal "testaddr", customer.add_bch_address.sync
+		assert_mock CustomerFinancials::REDIS
+		assert_mock CustomerFinancials::ELECTRUM_BCH
+	end
+	em :test_add_bch_address
 end

test/test_registration.rb 🔗

@@ -665,7 +665,7 @@ class RegistrationTest < Minitest::Test
 					[Matching.new do |reply|
 						assert_equal :canceled, reply.status
 						assert_equal "1.000000", reply.form.field("amount").value
-						assert_equal "testaddr", reply.form.field("bch_addresses").value
+						assert_equal "testaddr", reply.form.field("btc_addresses").value
 						true
 					end]
 				)
@@ -692,7 +692,7 @@ class RegistrationTest < Minitest::Test
 					customer(plan_name: "test_usd")
 				)
 				@customer.expect(
-					:add_btc_address,
+					:add_bch_address,
 					EMPromise.resolve("testaddr")
 				)
 				@bch = Registration::Payment::BCH.new(