Skip to content

Commit 80974fb

Browse files
committed
Rename SiteAction to MockSiteAction that is only used in Yosemite unit tests to avoid conflict with SiteAction usage in the app.
1 parent 896c741 commit 80974fb

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

Yosemite/YosemiteTests/Base/DispatcherTests.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ class DispatcherTests: XCTestCase {
2121
///
2222
func testProcessorEffectivelyGetsRegistered() {
2323
let processor = MockActionsProcessor()
24-
dispatcher.register(processor: processor, for: SiteAction.self)
25-
XCTAssertTrue(dispatcher.isProcessorRegistered(processor, for: SiteAction.self))
24+
dispatcher.register(processor: processor, for: MockSiteAction.self)
25+
XCTAssertTrue(dispatcher.isProcessorRegistered(processor, for: MockSiteAction.self))
2626
}
2727

2828
/// Verifies that a processor only receives the actions it's been registered to.
2929
///
3030
func testProcessorsReceiveOnlyRegisteredActions() {
31-
dispatcher.register(processor: processor, for: SiteAction.self)
31+
dispatcher.register(processor: processor, for: MockSiteAction.self)
3232

3333
XCTAssertTrue(processor.receivedActions.isEmpty)
34-
dispatcher.dispatch(SiteAction.refreshSites)
34+
dispatcher.dispatch(MockSiteAction.refreshSites)
3535
XCTAssertEqual(processor.receivedActions.count, 1)
3636

3737
dispatcher.dispatch(MockAccountAction.authenticate)
@@ -41,13 +41,13 @@ class DispatcherTests: XCTestCase {
4141
/// Verifies that a registered processor receive all of the posted actions.
4242
///
4343
func testProcessorsReceiveRegisteredActions() {
44-
dispatcher.register(processor: processor, for: SiteAction.self)
44+
dispatcher.register(processor: processor, for: MockSiteAction.self)
4545
XCTAssertTrue(processor.receivedActions.isEmpty)
4646

47-
dispatcher.dispatch(SiteAction.refreshSites)
47+
dispatcher.dispatch(MockSiteAction.refreshSites)
4848
XCTAssertEqual(processor.receivedActions.count, 1)
4949

50-
dispatcher.dispatch(SiteAction.refreshSite(identifier: 123))
50+
dispatcher.dispatch(MockSiteAction.refreshSite(identifier: 123))
5151
XCTAssertEqual(processor.receivedActions.count, 2)
5252
}
5353

@@ -56,23 +56,23 @@ class DispatcherTests: XCTestCase {
5656
func testUnregisteredProcessorsDoNotReceiveAnyActions() {
5757
XCTAssertTrue(processor.receivedActions.isEmpty)
5858

59-
dispatcher.register(processor: processor, for: SiteAction.self)
60-
dispatcher.dispatch(SiteAction.refreshSites)
59+
dispatcher.register(processor: processor, for: MockSiteAction.self)
60+
dispatcher.dispatch(MockSiteAction.refreshSites)
6161
XCTAssertEqual(processor.receivedActions.count, 1)
6262

6363
dispatcher.unregister(processor: processor)
64-
dispatcher.dispatch(SiteAction.refreshSites)
64+
dispatcher.dispatch(MockSiteAction.refreshSites)
6565
dispatcher.dispatch(MockAccountAction.authenticate)
6666
XCTAssertEqual(processor.receivedActions.count, 1)
6767
}
6868

6969
/// Verifies that the Dispatcher does not strongly retain the ActionsProcessors.
7070
///
7171
func testProcessorsAreNotStronglyRetainedByDispatcher() {
72-
dispatcher.register(processor: processor, for: SiteAction.self)
73-
XCTAssertNotNil(dispatcher.processor(for: SiteAction.self))
72+
dispatcher.register(processor: processor, for: MockSiteAction.self)
73+
XCTAssertNotNil(dispatcher.processor(for: MockSiteAction.self))
7474
processor = nil
7575

76-
XCTAssertNil(dispatcher.processor(for: SiteAction.self))
76+
XCTAssertNil(dispatcher.processor(for: MockSiteAction.self))
7777
}
7878
}

Yosemite/YosemiteTests/Mocks/MockSiteStore.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Yosemite
44

55
// MARK: - Represents a Site Action.
66
//
7-
enum SiteAction: Action {
7+
enum MockSiteAction: Action {
88
case refreshSite(identifier: Int)
99
case refreshSites
1010
}
@@ -14,14 +14,14 @@ enum SiteAction: Action {
1414
//
1515
class MockSiteStore: Store {
1616

17-
var receivedActions = [SiteAction]()
17+
var receivedActions = [MockSiteAction]()
1818

1919
override func registerSupportedActions(in dispatcher: Dispatcher) {
20-
dispatcher.register(processor: self, for: SiteAction.self)
20+
dispatcher.register(processor: self, for: MockSiteAction.self)
2121
}
2222

2323
override func onAction(_ action: Action) {
24-
guard let accountAction = action as? SiteAction else {
24+
guard let accountAction = action as? MockSiteAction else {
2525
return
2626
}
2727

0 commit comments

Comments
 (0)