Skip to content

Commit b53e415

Browse files
committed
add test
1 parent d53c03b commit b53e415

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/unit/test-class-wc-payments-utils.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,35 @@ public function test_is_store_api_request_with_url_with_no_path() {
11221122
$this->assertFalse( WC_Payments_Utils::is_store_api_request() );
11231123
}
11241124

1125+
public function test_is_any_bnpl_supporting_country() {
1126+
// Test supported country and currency combination (US with USD).
1127+
$this->assertTrue(
1128+
WC_Payments_Utils::is_any_bnpl_supporting_country(
1129+
[ 'afterpay_clearpay', 'klarna' ],
1130+
'US',
1131+
'USD'
1132+
)
1133+
);
1134+
1135+
// Test unsupported country and currency combination.
1136+
$this->assertFalse(
1137+
WC_Payments_Utils::is_any_bnpl_supporting_country(
1138+
[ 'afterpay_clearpay', 'klarna' ],
1139+
'CN',
1140+
'CNY'
1141+
)
1142+
);
1143+
1144+
// Test with empty enabled methods.
1145+
$this->assertFalse(
1146+
WC_Payments_Utils::is_any_bnpl_supporting_country(
1147+
[],
1148+
'US',
1149+
'USD'
1150+
)
1151+
);
1152+
}
1153+
11251154
public function test_is_any_bnpl_method_available() {
11261155
// Price within range for Afterpay/Clearpay in the US.
11271156
$this->assertTrue(

0 commit comments

Comments
 (0)