Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run swift-format #23

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Features/Sources/Settings/APIKey/APIKeySetting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct APIKeySetting {
case setAPIKeyInput(String)
case updateButtonTapped
}

@Dependency(\.apiKeyClient) private var apiKeyClient

public init() {}
Expand Down
2 changes: 1 addition & 1 deletion Features/Sources/Settings/Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public struct Settings {
case path(StackActionOf<Path>)
case popToRoot
}

@Dependency(\.apiKeyClient) private var apiKeyClient

public var body: some ReducerOf<Self> {
Expand Down
13 changes: 7 additions & 6 deletions Features/Tests/SettingsTests/APIKeySettingTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import ComposableArchitecture
@testable import Settings
import Testing

@testable import Settings

@MainActor
struct APIKeySettingTests {
@Test
Expand All @@ -11,28 +12,28 @@ struct APIKeySettingTests {
) {
APIKeySetting()
}

await store.send(.setAPIKeyInput("test")) {
$0.apiKeyInput = .init(rawValue: "test")
}
}

@Test
func onAppear() async throws {
let store = TestStore(
initialState: APIKeySetting.State()
) {
APIKeySetting()
}

store.dependencies.apiKeyClient.getKey = {
.init(rawValue: "test")
}

await store.send(.onAppear) {
$0.apiKeyInput = .init(rawValue: "test")
}
}

// TODO: add test case for `updateButtonTapped`
}
2 changes: 1 addition & 1 deletion Features/Tests/SettingsTests/APIKeyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct APIKeyTests {
func masked() {
var key = APIKey(rawValue: "")
#expect(key.masked == nil)

key = .init(rawValue: "test")
#expect(key.masked == "t***")
}
Expand Down
4 changes: 2 additions & 2 deletions Features/Tests/SettingsTests/SettingsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ struct SettingsTests {
) {
Settings()
}

store.dependencies.apiKeyClient.getKey = {
.init(rawValue: "test")
}

await store.send(.onAppear) {
$0.apiKey = .init(rawValue: "test")
}
Expand Down