Skip to content

Commit

Permalink
Canopy type conformance in extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaanus Kase committed Aug 6, 2024
1 parent 702ae27 commit 11fb42c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Targets/CanopyTestTools/Sources/MockCanopy/MockCanopy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ import CloudKit
/// You initialize MockCanopy with static container and databases, perhaps instances
/// of `ReplayingMockContainer` and `ReplayingMockDatabase`, and
/// then plays back their static content in response to Canopy API calls.
public struct MockCanopy: CanopyType {
public struct MockCanopy {
private let container: CKContainerAPIType
private let privateDatabase: CKDatabaseAPIType
private let publicDatabase: CKDatabaseAPIType
private let sharedDatabase: CKDatabaseAPIType

public init(
container: CKContainerAPIType = ReplayingMockContainer(),
privateDatabase: CKDatabaseAPIType = ReplayingMockDatabase(),
publicDatabase: CKDatabaseAPIType = ReplayingMockDatabase(),
sharedDatabase: CKDatabaseAPIType = ReplayingMockDatabase()
) {
self.container = container
self.privateDatabase = privateDatabase
self.publicDatabase = publicDatabase
self.sharedDatabase = sharedDatabase
}
}

extension MockCanopy: CanopyType {
public func containerAPI() async -> CKContainerAPIType {
container
}
Expand Down

0 comments on commit 11fb42c

Please # to comment.