Skip to content

Commit 27be410

Browse files
committed
Update unit tests from PR code changes.
1 parent b7e8f3c commit 27be410

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Yosemite/YosemiteTests/Stores/AccountStoreTests.swift

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ final class AccountStoreTests: XCTestCase {
356356
XCTAssertEqual(jetpackSite.siteID, siteIDOfJetpackSite)
357357
}
358358

359-
/// Verifies that `synchronizeSites` effectively persists a Jetpack Connection Package site with original metadata when WP site settings request fails.
359+
/// Verifies that `synchronizeSites` effectively persists a Jetpack Connection Package site without any changes when WP site settings request fails.
360360
///
361-
func test_synchronizeSites_persists_a_jetpack_cp_site_with_existing_metadata_when_wp_settings_request_fails() throws {
361+
func test_synchronizeSites_persists_a_jetpack_cp_site_without_any_changes_when_wp_settings_request_fails() throws {
362362
// Given
363363
let siteID = Int64(255)
364364
let remote = MockAccountRemote()
@@ -368,7 +368,8 @@ final class AccountStoreTests: XCTestCase {
368368
description: "old description",
369369
url: "oldurl",
370370
isJetpackThePluginInstalled: false,
371-
isJetpackConnected: true)
371+
isJetpackConnected: true,
372+
isWooCommerceActive: false)
372373
])
373374
remote.whenFetchingWordPressSiteSettings(siteID: siteID, thenReturn: .failure(NetworkError.timeout))
374375
remote.whenCheckingIfWooCommerceIsActive(siteID: siteID, thenReturn: .success(true))
@@ -396,17 +397,23 @@ final class AccountStoreTests: XCTestCase {
396397
XCTAssertEqual(jcpSite.name, "old name")
397398
XCTAssertEqual(jcpSite.tagline, "old description")
398399
XCTAssertEqual(jcpSite.url, "oldurl")
399-
XCTAssertTrue(jcpSite.isWooCommerceActive?.boolValue == true)
400+
XCTAssertTrue(jcpSite.isWooCommerceActive?.boolValue == false)
400401
}
401402

402-
/// Verifies that `synchronizeSites` persists a Jetpack Connection Package site with original isWooCommerceActive when WC site settings request fails.
403+
/// Verifies that `synchronizeSites` persists a Jetpack Connection Package site without any changes when WC site settings request fails.
403404
///
404-
func test_synchronizeSites_persists_a_jetpack_cp_site_without_isWooCommerceActive_change_when_wc_settings_request_fails() throws {
405+
func test_synchronizeSites_persists_a_jetpack_cp_site_without_any_changes_when_wc_settings_request_fails() throws {
405406
// Given
406407
let siteID = Int64(255)
407408
let remote = MockAccountRemote()
408409
remote.loadSitesResult = .success([
409-
Site.fake().copy(siteID: siteID, isJetpackThePluginInstalled: false, isJetpackConnected: true, isWooCommerceActive: false)
410+
Site.fake().copy(siteID: siteID,
411+
name: "old name",
412+
description: "old description",
413+
url: "oldurl",
414+
isJetpackThePluginInstalled: false,
415+
isJetpackConnected: true,
416+
isWooCommerceActive: false)
410417
])
411418
remote.whenFetchingWordPressSiteSettings(siteID: siteID, thenReturn: .success(.init(name: "new name",
412419
description: "new description",
@@ -431,6 +438,9 @@ final class AccountStoreTests: XCTestCase {
431438
XCTAssertEqual(viewStorage.countObjects(ofType: Storage.Site.self, matching: jcpSitePredicate), 1)
432439
let jcpSite = try XCTUnwrap(viewStorage.firstObject(ofType: Storage.Site.self, matching: jcpSitePredicate))
433440
XCTAssertEqual(jcpSite.siteID, siteID)
441+
XCTAssertEqual(jcpSite.name, "old name")
442+
XCTAssertEqual(jcpSite.tagline, "old description")
443+
XCTAssertEqual(jcpSite.url, "oldurl")
434444
XCTAssertTrue(jcpSite.isWooCommerceActive?.boolValue == false)
435445
XCTAssertFalse(jcpSite.isJetpackThePluginInstalled)
436446
XCTAssertTrue(jcpSite.isJetpackConnected)

0 commit comments

Comments
 (0)