Skip to content

Commit 6561866

Browse files
committed
Update unit tests
1 parent 00b21cc commit 6561866

File tree

4 files changed

+348
-80
lines changed

4 files changed

+348
-80
lines changed

Modules/Sources/Networking/Mapper/JetpackConnectionProvisionMapper.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ public struct JetpackConnectionProvisionResponse: Decodable {
1717
public let userId: Int64
1818
public let scope: String
1919
public let secret: String
20+
21+
public init(userId: Int64, scope: String, secret: String) {
22+
self.userId = userId
23+
self.scope = scope
24+
self.secret = secret
25+
}
2026
}

WooCommerce/Classes/Authentication/Jetpack Setup/Native Jetpack Setup/JetpackSetupViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private extension JetpackSetupViewModel {
272272
switch result {
273273
case .success:
274274
self.trackSetupDuringLogin(.loginJetpackSetupActivationSuccessful)
275-
self.fetchJetpackConnectionURL()
275+
self.checkJetpackConnection(afterConnection: false)
276276
case .failure(let error):
277277
self.trackSetupDuringLogin(.loginJetpackSetupActivationFailed, failure: error)
278278
self.trackSetupAfterLogin(failure: error)

WooCommerce/WooCommerceTests/Authentication/Jetpack Setup/JetpackSetupHostingControllerTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import Foundation
22
import XCTest
33

44
@testable import WooCommerce
5+
@testable import Yosemite
56

67
/// Test cases for `JetpackSetupHostingController`.
78
///
89
final class JetpackSetupHostingControllerTests: XCTestCase {
910
private let testURL = "https://test.com"
11+
private let credentials = Credentials.wpcom(username: "test", authToken: "secret", siteAddress: "https://example.com")
1012

1113
func test_it_tracks_login_jetpack_setup_screen_viewed_when_view_loads_for_unauthenticated_users() throws {
1214
// Given
@@ -15,6 +17,7 @@ final class JetpackSetupHostingControllerTests: XCTestCase {
1517
let analytics = WooAnalytics(analyticsProvider: analyticsProvider)
1618
let viewController = JetpackSetupHostingController(siteURL: testURL,
1719
connectionOnly: true,
20+
wpcomCredentials: credentials,
1821
stores: stores,
1922
analytics: analytics,
2023
onStoreNavigation: { _ in })
@@ -33,6 +36,7 @@ final class JetpackSetupHostingControllerTests: XCTestCase {
3336
let analytics = WooAnalytics(analyticsProvider: analyticsProvider)
3437
let viewController = JetpackSetupHostingController(siteURL: testURL,
3538
connectionOnly: true,
39+
wpcomCredentials: credentials,
3640
stores: stores,
3741
analytics: analytics,
3842
onStoreNavigation: { _ in })

0 commit comments

Comments
 (0)