diff --git a/Features/Sources/Settings/APIKey/APIKeySetting.swift b/Features/Sources/Settings/APIKey/APIKeySetting.swift index 9d6c876..3d00554 100644 --- a/Features/Sources/Settings/APIKey/APIKeySetting.swift +++ b/Features/Sources/Settings/APIKey/APIKeySetting.swift @@ -27,7 +27,7 @@ public struct APIKeySetting { case setAPIKeyInput(String) case updateButtonTapped } - + @Dependency(\.apiKeyClient) private var apiKeyClient public init() {} diff --git a/Features/Sources/Settings/Settings/Settings.swift b/Features/Sources/Settings/Settings/Settings.swift index 3da1ee8..54a052e 100644 --- a/Features/Sources/Settings/Settings/Settings.swift +++ b/Features/Sources/Settings/Settings/Settings.swift @@ -26,7 +26,7 @@ public struct Settings { case path(StackActionOf) case popToRoot } - + @Dependency(\.apiKeyClient) private var apiKeyClient public var body: some ReducerOf { diff --git a/Features/Tests/SettingsTests/APIKeySettingTests.swift b/Features/Tests/SettingsTests/APIKeySettingTests.swift index 841e102..3ae3e0a 100644 --- a/Features/Tests/SettingsTests/APIKeySettingTests.swift +++ b/Features/Tests/SettingsTests/APIKeySettingTests.swift @@ -1,7 +1,8 @@ import ComposableArchitecture -@testable import Settings import Testing +@testable import Settings + @MainActor struct APIKeySettingTests { @Test @@ -11,12 +12,12 @@ struct APIKeySettingTests { ) { APIKeySetting() } - + await store.send(.setAPIKeyInput("test")) { $0.apiKeyInput = .init(rawValue: "test") } } - + @Test func onAppear() async throws { let store = TestStore( @@ -24,15 +25,15 @@ struct APIKeySettingTests { ) { APIKeySetting() } - + store.dependencies.apiKeyClient.getKey = { .init(rawValue: "test") } - + await store.send(.onAppear) { $0.apiKeyInput = .init(rawValue: "test") } } - + // TODO: add test case for `updateButtonTapped` } diff --git a/Features/Tests/SettingsTests/APIKeyTests.swift b/Features/Tests/SettingsTests/APIKeyTests.swift index f454475..a1952fe 100644 --- a/Features/Tests/SettingsTests/APIKeyTests.swift +++ b/Features/Tests/SettingsTests/APIKeyTests.swift @@ -8,7 +8,7 @@ struct APIKeyTests { func masked() { var key = APIKey(rawValue: "") #expect(key.masked == nil) - + key = .init(rawValue: "test") #expect(key.masked == "t***") } diff --git a/Features/Tests/SettingsTests/SettingsTests.swift b/Features/Tests/SettingsTests/SettingsTests.swift index 40feb5f..1ae105e 100644 --- a/Features/Tests/SettingsTests/SettingsTests.swift +++ b/Features/Tests/SettingsTests/SettingsTests.swift @@ -12,11 +12,11 @@ struct SettingsTests { ) { Settings() } - + store.dependencies.apiKeyClient.getKey = { .init(rawValue: "test") } - + await store.send(.onAppear) { $0.apiKey = .init(rawValue: "test") }