2020-09-01 00:33:49 -07:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
2020-09-02 20:28:34 -07:00
|
|
|
import DB
|
2020-08-31 03:21:01 -07:00
|
|
|
import Foundation
|
|
|
|
import HTTP
|
2020-09-07 19:12:38 -07:00
|
|
|
import Keychain
|
2020-09-03 17:54:05 -07:00
|
|
|
import MockKeychain
|
2020-08-31 11:57:02 -07:00
|
|
|
import ServiceLayer
|
2020-08-31 03:21:01 -07:00
|
|
|
import Stubbing
|
|
|
|
|
2020-08-31 11:57:02 -07:00
|
|
|
public extension AppEnvironment {
|
2020-09-23 00:04:37 -07:00
|
|
|
static func mock(session: URLSession = URLSession(configuration: .stubbing),
|
2020-09-07 19:12:38 -07:00
|
|
|
webAuthSessionType: WebAuthSession.Type = SuccessfulMockWebAuthSession.self,
|
|
|
|
keychain: Keychain.Type = MockKeychain.self,
|
|
|
|
userDefaults: UserDefaults = MockUserDefaults(),
|
|
|
|
userNotificationClient: UserNotificationClient = .mock,
|
2020-09-12 17:50:22 -07:00
|
|
|
uuid: @escaping () -> UUID = UUID.init,
|
2020-09-07 19:12:38 -07:00
|
|
|
inMemoryContent: Bool = true,
|
|
|
|
fixtureDatabase: IdentityDatabase? = nil) -> Self {
|
2020-09-01 00:33:49 -07:00
|
|
|
AppEnvironment(
|
2020-09-23 00:04:37 -07:00
|
|
|
session: session,
|
2020-09-08 18:02:55 -07:00
|
|
|
webAuthSessionType: webAuthSessionType,
|
|
|
|
keychain: keychain,
|
|
|
|
userDefaults: userDefaults,
|
|
|
|
userNotificationClient: userNotificationClient,
|
2020-09-12 17:50:22 -07:00
|
|
|
uuid: uuid,
|
2020-09-08 18:02:55 -07:00
|
|
|
inMemoryContent: inMemoryContent,
|
2020-09-07 19:12:38 -07:00
|
|
|
fixtureDatabase: fixtureDatabase)
|
2020-09-01 00:33:49 -07:00
|
|
|
}
|
2020-08-31 03:21:01 -07:00
|
|
|
}
|