From 0366af4f8be6577d641bb4144268cddcbeba05ff Mon Sep 17 00:00:00 2001 From: Leif Date: Fri, 15 Dec 2023 14:37:56 -0700 Subject: [PATCH] Update tests --- Tests/AppStateTests/AppDependencyTests.swift | 4 ++-- Tests/AppStateTests/SecureStateTests.swift | 18 ++++++++++-------- Tests/AppStateTests/SyncStateTests.swift | 4 +++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Tests/AppStateTests/AppDependencyTests.swift b/Tests/AppStateTests/AppDependencyTests.swift index 77eba0c..3ffc61b 100644 --- a/Tests/AppStateTests/AppDependencyTests.swift +++ b/Tests/AppStateTests/AppDependencyTests.swift @@ -5,13 +5,13 @@ fileprivate protocol Networking { func fetch() } -fileprivate struct NetworkService: Networking { +fileprivate class NetworkService: Networking { func fetch() { fatalError() } } -fileprivate struct MockNetworking: Networking { +fileprivate class MockNetworking: Networking { func fetch() { } diff --git a/Tests/AppStateTests/SecureStateTests.swift b/Tests/AppStateTests/SecureStateTests.swift index b20276c..feb5af6 100644 --- a/Tests/AppStateTests/SecureStateTests.swift +++ b/Tests/AppStateTests/SecureStateTests.swift @@ -8,11 +8,11 @@ fileprivate extension Application { } } -fileprivate struct ExampleStoredValue { +fileprivate struct ExampleSecureValue { @SecureState(\.secureValue) var token: String? } -fileprivate class ExampleStoringViewModel: ObservableObject { +fileprivate class ExampleSecureViewModel: ObservableObject { @SecureState(\.secureValue) var token: String? func testPropertyWrapper() { @@ -23,17 +23,19 @@ fileprivate class ExampleStoringViewModel: ObservableObject { final class SecureStateTests: XCTestCase { override class func setUp() { - Application.logging(isEnabled: true) + Application + .logging(isEnabled: true) + .load(dependency: \.keychain) } override class func tearDown() { - Application.logger.debug("StoredStateTests \(Application.description)") + Application.logger.debug("SecureStateTests \(Application.description)") } - func testStoredState() { + func testSecureState() { XCTAssertNil(Application.secureState(\.secureValue).value) - let secureValue = ExampleStoredValue() + let secureValue = ExampleSecureValue() XCTAssertEqual(secureValue.token, nil) @@ -45,7 +47,7 @@ final class SecureStateTests: XCTestCase { XCTAssertNotEqual(secureValue.token, "QWERTY") - Application.logger.debug("StoredStateTests \(Application.description)") + Application.logger.debug("SecureStateTests \(Application.description)") secureValue.token = nil @@ -55,7 +57,7 @@ final class SecureStateTests: XCTestCase { func testStoringViewModel() { XCTAssertNil(Application.secureState(\.secureValue).value) - let viewModel = ExampleStoringViewModel() + let viewModel = ExampleSecureViewModel() XCTAssertEqual(viewModel.token, nil) diff --git a/Tests/AppStateTests/SyncStateTests.swift b/Tests/AppStateTests/SyncStateTests.swift index f33db0f..ffd02c1 100644 --- a/Tests/AppStateTests/SyncStateTests.swift +++ b/Tests/AppStateTests/SyncStateTests.swift @@ -43,7 +43,9 @@ fileprivate class ExampleStoringViewModel: ObservableObject { @available(iOS 15.0, watchOS 9.0, macOS 11.0, tvOS 15.0, *) final class SyncStateTests: XCTestCase { override class func setUp() { - Application.logging(isEnabled: true) + Application + .logging(isEnabled: true) + .load(dependency: \.icloudStore) } override class func tearDown() {