metatext-app-ios-iphone-ipad/ServiceLayer/Sources/ServiceLayerMocks/MockAppEnvironment.swift

33 lines
1.2 KiB
Swift
Raw Normal View History

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