Improved the initializer function for the AmiiboService service type in the library target to use a AmiiboLiveClient client type as a default value.
This commit is contained in:
@@ -18,17 +18,14 @@ public struct AmiiboService {
|
|||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
/// A client to interact with the endpoints.
|
/// A client to interact with the endpoints.
|
||||||
private let client: any APIClient
|
private let client: any AmiiboClient
|
||||||
|
|
||||||
// MARK: Initializers
|
// MARK: Initializers
|
||||||
|
|
||||||
/// Initializes this service with a specific client type.
|
/// Initializes this service with a specific client type.
|
||||||
/// - Parameter client: A representation of a client to use to interact with the endpoints.
|
/// - Parameter client: A client to use to interact with the endpoints.
|
||||||
public init(_ client: AmiiboClient) {
|
public init(client: some AmiiboClient = AmiiboLiveClient()) {
|
||||||
self.client = switch client {
|
self.client = client
|
||||||
case let .mock(mockClient): mockClient
|
|
||||||
case let .live(liveClient): liveClient
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Functions
|
// MARK: Functions
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct AmiiboServiceLiveTests {
|
|||||||
// MARK: Initializers
|
// MARK: Initializers
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
self.service = .init(.live())
|
self.service = .init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Functions tests
|
// MARK: Functions tests
|
||||||
|
|||||||
Reference in New Issue
Block a user