metatext/ServiceLayer/Sources/ServiceLayerMocks/MockAppEnvironment.swift

32 lines
1.2 KiB
Swift
Raw Normal View History

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