Files
sure/test/models/provider/sophtron_adapter_test.rb
Juan José Mata 81cdccb768 [codex] Complete Sophtron account mapping (#1698)
* Complete Sophtron account mapping

* Clarify Sophtron login challenge flow

* Add Sophtron connection UI timeout

* Treat Sophtron timeout jobs as failed

* Reset failed Sophtron connection state

* Handle stale Sophtron connection jobs

* Advance Sophtron polling timeout

* Shorten Sophtron connection timeout

* Fix Sophtron modal polling updates

* Stabilize Sophtron MFA polling

* Give Sophtron OTP challenges more time

* Clarify Sophtron institution login failures

* Extend Sophtron polling during login progress

* Probe Sophtron accounts after completed MFA step

* Align Sophtron dialogs with design system

* Start Sophtron initial load after linking accounts

* Fix Sophtron initial transaction load

* Fail Sophtron sync without institution connection

* Fix tests

* Wrap Sophtron account linking in transaction

* Wrap Sophtron provider responses

* Fix Sophtron MFA security tests

* Guard Sophtron MFA challenge arrays

* Respect Sophtron initial load window

* Use unique Sophtron MFA answer field ids

* Address Sophtron review follow-ups

* Fix Sophtron transaction sync refresh

* Avoid blocking Sophtron refresh polling

* Move Sophtron account helpers to model

* Keep Sophtron grouping provider-level

* Start new Sophtron institution links

* Isolate Sophtron institution connections

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
2026-05-08 15:15:23 +02:00

36 lines
1.3 KiB
Ruby

require "uri"
require "test_helper"
class Provider::SophtronAdapterTest < ActiveSupport::TestCase
test "new account connection config starts a new institution connection" do
config = Provider::SophtronAdapter.connection_configs(family: families(:empty)).first
new_account_uri = URI.parse(config[:new_account_path].call("Depository", "/accounts"))
assert_equal "/sophtron_items/select_accounts", new_account_uri.path
assert_includes new_account_uri.query, "accountable_type=Depository"
assert_includes new_account_uri.query, "return_to=%2Faccounts"
assert_includes new_account_uri.query, "connect_new_institution=true"
end
test "institution_name does not fall back to another institution item" do
item = families(:dylan_family).sophtron_items.create!(
name: "Sophtron Connection",
user_id: "developer-user",
access_key: Base64.strict_encode64("secret-key"),
institution_name: "Amazon",
user_institution_id: "ui-amazon"
)
account = item.sophtron_accounts.create!(
name: "Juan",
account_id: "card-1",
currency: "USD",
balance: 1_947.18,
institution_metadata: { user_institution_id: "ui-apple" }
)
assert_nil Provider::SophtronAdapter.new(account).institution_name
end
end