Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
timur27 committed Feb 21, 2025
1 parent d53c03b commit b53e415
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/unit/test-class-wc-payments-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,35 @@ public function test_is_store_api_request_with_url_with_no_path() {
$this->assertFalse( WC_Payments_Utils::is_store_api_request() );
}

public function test_is_any_bnpl_supporting_country() {
// Test supported country and currency combination (US with USD).
$this->assertTrue(
WC_Payments_Utils::is_any_bnpl_supporting_country(
[ 'afterpay_clearpay', 'klarna' ],
'US',
'USD'
)
);

// Test unsupported country and currency combination.
$this->assertFalse(
WC_Payments_Utils::is_any_bnpl_supporting_country(
[ 'afterpay_clearpay', 'klarna' ],
'CN',
'CNY'
)
);

// Test with empty enabled methods.
$this->assertFalse(
WC_Payments_Utils::is_any_bnpl_supporting_country(
[],
'US',
'USD'
)
);
}

public function test_is_any_bnpl_method_available() {
// Price within range for Afterpay/Clearpay in the US.
$this->assertTrue(
Expand Down

0 comments on commit b53e415

Please sign in to comment.