@@ -325,43 +325,19 @@ final class SimplePaymentsMethodsViewModelTests: XCTestCase {
325325 XCTAssertTrue ( viewModel. showPayWithCardRow)
326326 }
327327
328- func test_paymentLinkRow_is_hidden_if_payment_path_is_not_available ( ) {
328+ func test_paymentLinkRow_is_hidden_if_payment_link_is_not_available ( ) {
329329 // Given
330- let stores = MockStoresManager ( sessionManager: . testingInstance)
331- stores. whenReceivingAction ( ofType: SettingAction . self) { action in
332- switch action {
333- case let . getPaymentsPagePath( _, onCompletion) :
334- onCompletion ( . failure( . paymentsPageNotFound) )
335- default :
336- XCTFail ( " Unexpected action: \( action) " )
337- }
338- }
339-
340- // When
341- let viewModel = SimplePaymentsMethodsViewModel ( formattedTotal: " $12.00 " , stores: stores)
330+ let viewModel = SimplePaymentsMethodsViewModel ( paymentLink: nil , formattedTotal: " $12.00 " )
342331
343332 // Then
344333 XCTAssertFalse ( viewModel. showPaymentLinkRow)
345334 XCTAssertNil ( viewModel. paymentLink)
346335 }
347336
348- func test_paymentLinkRow_is_shown_if_payment_path_is_available ( ) {
337+ func test_paymentLinkRow_is_shown_if_payment_link_is_available ( ) {
349338 // Given
350- let session = SessionManager . testingInstance
351- session. defaultSite = . fake( ) . copy ( url: " https://www.test-store.com " )
352-
353- let stores = MockStoresManager ( sessionManager: session)
354- stores. whenReceivingAction ( ofType: SettingAction . self) { action in
355- switch action {
356- case let . getPaymentsPagePath( _, onCompletion) :
357- onCompletion ( . success( " order-pay " ) )
358- default :
359- XCTFail ( " Unexpected action: \( action) " )
360- }
361- }
362-
363- // When
364- let viewModel = SimplePaymentsMethodsViewModel ( formattedTotal: " $12.00 " , stores: stores)
339+ let paymentURL = URL ( string: " http://www.automattic.com " )
340+ let viewModel = SimplePaymentsMethodsViewModel ( paymentLink: paymentURL, formattedTotal: " $12.00 " )
365341
366342 // Then
367343 XCTAssertTrue ( viewModel. showPaymentLinkRow)
0 commit comments