mirror of
https://github.com/we-promise/sure.git
synced 2026-05-25 05:24:57 +00:00
* fix(enable_banking): match bank list search against BIC, not just name Bank-search filter on the Enable Banking bank-selection modal only indexed `aspsp[:name]`, so users searching by BIC code (e.g. `INGDDEFF`) got no results even when the bank was rendered in the list. Switch the per-item data attribute to a `name + BIC` haystack and read from it in the Stimulus controller, so either token matches. Refs #1814 * style(bank_search): apply Biome formatting to forEach callback (#1874 review)
43 lines
1.4 KiB
Ruby
43 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "test_helper"
|
|
require "openssl"
|
|
|
|
class EnableBankingItemsControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
sign_in users(:family_admin)
|
|
@family = families(:dylan_family)
|
|
@item = @family.enable_banking_items.create!(
|
|
name: "Test Connection",
|
|
country_code: "DE",
|
|
application_id: "test_app_id",
|
|
client_certificate: OpenSSL::PKey::RSA.new(2048).to_pem
|
|
)
|
|
end
|
|
|
|
test "select_bank exposes ASPSP BIC in the searchable data attribute" do
|
|
Provider::EnableBanking.any_instance.stubs(:get_aspsps).returns(
|
|
aspsps: [
|
|
{
|
|
name: "ING-DiBa AG",
|
|
country: "DE",
|
|
bic: "INGDDEFF",
|
|
beta: false,
|
|
psu_types: [ "personal" ],
|
|
auth_methods: [ { approach: "REDIRECT" } ]
|
|
}
|
|
]
|
|
)
|
|
|
|
get select_bank_enable_banking_item_url(@item)
|
|
|
|
assert_response :success
|
|
haystack = @response.body[/data-bank-search="([^"]*)"/, 1]
|
|
assert haystack, "Expected list items to render a data-bank-search attribute the client filter reads from"
|
|
assert_includes haystack, "ingddeff",
|
|
"Expected the searchable data attribute to include the BIC so users can find banks by BIC code"
|
|
assert_includes haystack, "ing-diba ag",
|
|
"Expected the searchable data attribute to still include the bank name (existing name-search behavior)"
|
|
end
|
|
end
|