From b9beae554447203f0a26015b02671f84efa97260 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 25 Jun 2024 08:59:06 -0500 Subject: [PATCH] Unless it's one of our jids, is it really a customer? --- lib/customer_repo.rb | 2 +- test/test_customer_repo.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/customer_repo.rb b/lib/customer_repo.rb index b73e047570ca4ae9ae3fbf3758481fa11f254779..6bde93f6c93222c28fe3230c829cdbd1b41e4cf6 100644 --- a/lib/customer_repo.rb +++ b/lib/customer_repo.rb @@ -64,7 +64,7 @@ class CustomerRepo Tel = Struct.new(:tel) do def keys(redis) redis.get("catapult_jid-#{tel}").then do |jid| - raise NotFound, "No jid" unless jid + raise NotFound, "No jid" unless jid.to_s =~ /\Acustomer_/ JID.for(jid).keys(redis, tel: tel) end diff --git a/test/test_customer_repo.rb b/test/test_customer_repo.rb index 3237bc747b0a2aee101c2776cdc10d0e343191a6..df9930d7c5240a25b10084dc3c576739eb6b3511 100644 --- a/test/test_customer_repo.rb +++ b/test/test_customer_repo.rb @@ -110,9 +110,9 @@ class CustomerRepoTest < Minitest::Test em :test_find_sgx_customer_by_phone def test_find_v2_customer_by_phone - customer = @repo.find_by_tel("+14445556666").sync - assert_kind_of Customer, customer - assert_equal "test_v2", customer.customer_id + assert_raises(CustomerRepo::NotFound) do + @repo.find_by_tel("+14445556666").sync + end end em :test_find_v2_customer_by_phone