diff --git a/README.md b/README.md index 2e7cb1a..3604e5c 100644 --- a/README.md +++ b/README.md @@ -147,10 +147,6 @@ import XCTest @testable import CacheStoreDemo class CacheStoreDemoTests: XCTestCase { - override func setUp() { - TestStoreFailure.handler = XCTFail - } - func testExample_success() throws { let store = TestStore( initialValues: [ diff --git a/Sources/CacheStore/Stores/Store.swift b/Sources/CacheStore/Stores/Store.swift index 7e0f57c..3454cb6 100644 --- a/Sources/CacheStore/Stores/Store.swift +++ b/Sources/CacheStore/Stores/Store.swift @@ -222,7 +222,7 @@ public class Store: ObservableObject, ActionH // MARK: - Void Dependency -public extension Store { +public extension Store where Dependency == Void { /// Creates a `ScopedStore` func scope( keyTransformation: c.BiDirectionalTransformation, diff --git a/Sources/CacheStore/Stores/TestStore.swift b/Sources/CacheStore/Stores/TestStore.swift index 625f626..fab9dd0 100644 --- a/Sources/CacheStore/Stores/TestStore.swift +++ b/Sources/CacheStore/Stores/TestStore.swift @@ -1,13 +1,14 @@ #if DEBUG import CustomDump import Foundation +import XCTestDynamicOverlay /// Facade typealias for XCTFail without importing XCTest public typealias FailureHandler = (_ message: String, _ file: StaticString, _ line: UInt) -> Void /// Static object to provide the `FailureHandler` to any `TestStore` public enum TestStoreFailure { - public static var handler: FailureHandler! + public static var handler: FailureHandler = XCTestDynamicOverlay.XCTFail } /// Testable `Store` where you can send and receive actions while expecting the changes @@ -42,18 +43,6 @@ public class TestStore { file: StaticString = #filePath, line: UInt = #line ) { - assert( - TestStoreFailure.handler != nil, - """ - Set `TestStoreFailure.handler` - - override func setUp() { - TestStoreFailure.handler = XCTFail - } - - """ - ) - store = Store(initialValues: initialValues, actionHandler: actionHandler, dependency: dependency).debug effects = [] initFile = file