Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cramsden committed Jan 17, 2025
1 parent 8e9aa37 commit 74e5a71
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class TopSitesMiddlewareTests: XCTestCase, StoreTestUtility {
)

let expectation = XCTestExpectation(description: "All relevant top sites middleware actions are dispatched")
expectation.expectedFulfillmentCount = 3
expectation.expectedFulfillmentCount = 2

mockStore.dispatchCalled = {
expectation.fulfill()
Expand All @@ -45,13 +45,13 @@ final class TopSitesMiddlewareTests: XCTestCase, StoreTestUtility {

XCTAssertEqual(mockTopSitesManager.getOtherSitesCalledCount, 1)
XCTAssertEqual(mockTopSitesManager.fetchSponsoredSitesCalledCount, 1)
XCTAssertEqual(mockTopSitesManager.recalculateTopSitesCalledCount, 3)
XCTAssertEqual(mockTopSitesManager.recalculateTopSitesCalledCount, 2)

let actionsCalled = try XCTUnwrap(mockStore.dispatchedActions as? [TopSitesAction])
let actionsType = try XCTUnwrap(actionsCalled.compactMap { $0.actionType } as? [TopSitesMiddlewareActionType])

XCTAssertEqual(mockStore.dispatchedActions.count, 3)
XCTAssertEqual(actionsType, [.retrievedUpdatedSites, .retrievedUpdatedSites, .retrievedUpdatedSites])
XCTAssertEqual(mockStore.dispatchedActions.count, 2)
XCTAssertEqual(actionsType, [.retrievedUpdatedSites, .retrievedUpdatedSites])
XCTAssertEqual(actionsCalled.last?.topSites?.count, 30)
}

Expand All @@ -63,7 +63,7 @@ final class TopSitesMiddlewareTests: XCTestCase, StoreTestUtility {
)

let expectation = XCTestExpectation(description: "All top sites middleware actions are dispatched")
expectation.expectedFulfillmentCount = 3
expectation.expectedFulfillmentCount = 2

mockStore.dispatchCalled = {
expectation.fulfill()
Expand All @@ -75,13 +75,13 @@ final class TopSitesMiddlewareTests: XCTestCase, StoreTestUtility {

XCTAssertEqual(mockTopSitesManager.getOtherSitesCalledCount, 1)
XCTAssertEqual(mockTopSitesManager.fetchSponsoredSitesCalledCount, 1)
XCTAssertEqual(mockTopSitesManager.recalculateTopSitesCalledCount, 3)
XCTAssertEqual(mockTopSitesManager.recalculateTopSitesCalledCount, 2)

let actionsCalled = try XCTUnwrap(mockStore.dispatchedActions as? [TopSitesAction])
let actionsType = try XCTUnwrap(actionsCalled.compactMap { $0.actionType } as? [TopSitesMiddlewareActionType])

XCTAssertEqual(mockStore.dispatchedActions.count, 3)
XCTAssertEqual(actionsType, [.retrievedUpdatedSites, .retrievedUpdatedSites, .retrievedUpdatedSites])
XCTAssertEqual(mockStore.dispatchedActions.count, 2)
XCTAssertEqual(actionsType, [.retrievedUpdatedSites, .retrievedUpdatedSites])
XCTAssertEqual(actionsCalled.last?.topSites?.count, 30)
}

Expand Down

0 comments on commit 74e5a71

Please sign in to comment.