Skip to content

Commit

Permalink
No Bug: Fix flakey ManageSiteConnectionsStoreTests (brave/brave-ios…
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHeaps committed Nov 7, 2023
1 parent 0891f04 commit e36bcd3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Tests/BraveWalletTests/ManageSiteConnectionsStoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Combine
import XCTest
import BraveCore
import Data
@testable import Data
import TestHelpers
@testable import BraveWallet

Expand Down Expand Up @@ -79,6 +79,8 @@ class ManageSiteConnectionsStoreTests: CoreDataTestCase {
backgroundSaveAndWaitForExpectation {
store.removeAllPermissions(from: [siteConnectionToRemove])
}
DataController.viewContext.refreshAllObjects()

// verify `siteConnections` is updated
XCTAssertEqual(store.siteConnections.count, 2)
XCTAssertNotEqual(store.siteConnections[0].url, siteConnectionToRemove.url)
Expand All @@ -101,6 +103,7 @@ class ManageSiteConnectionsStoreTests: CoreDataTestCase {
backgroundSaveAndWaitForExpectation {
store.removePermissions(for: .eth, from: [walletAccount], url: URL(string: siteConnectionToRemoveAccount.url)!)
}
DataController.viewContext.refreshAllObjects()

// verify `siteConnections` is updated to remove specific accounts from the `SiteConnection`
XCTAssertEqual(store.siteConnections.count, 3)
Expand All @@ -125,11 +128,14 @@ class ManageSiteConnectionsStoreTests: CoreDataTestCase {
backgroundSaveAndWaitForExpectation {
store.removePermissions(for: .eth, from: [walletAccount], url: URL(string: siteConnectionToRemove.url)!)
}
DataController.viewContext.refreshAllObjects()

// remove `walletAccount2` permissions for this `SiteConnection`
XCTAssertEqual(store.siteConnections[0].connectedAddresses.count, 1)
backgroundSaveAndWaitForExpectation {
store.removePermissions(for: .eth, from: [walletAccount2], url: URL(string: siteConnectionToRemove.url)!)
}
DataController.viewContext.refreshAllObjects()

// verify `siteConnections` is updated to remove the `SiteConnection` as all `connectedAddresses` are removed
XCTAssertEqual(store.siteConnections.count, 2)
Expand Down

0 comments on commit e36bcd3

Please sign in to comment.