Added custom enviroment flags for unit and UI tests.

This commit is contained in:
Stefan Ceriu
2022-04-13 17:19:11 +03:00
parent c605dca245
commit 3c0ca95e8f
6 changed files with 82 additions and 11 deletions
+25
View File
@@ -13,8 +13,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private var appCoordinator: AppCoordinator!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
if isRunningUnitTests {
return true
}
if isRunningUITests {
// Bootstrap a different version of the application
return true
}
appCoordinator = AppCoordinator()
appCoordinator.start()
return true
}
private var isRunningUnitTests: Bool {
#if DEBUG
ProcessInfo.processInfo.environment["IS_RUNNING_UNIT_TESTS"] == "1"
#else
false
#endif
}
private var isRunningUITests: Bool {
#if DEBUG
ProcessInfo.processInfo.environment["IS_RUNNING_UI_TESTS"] == "1"
#else
false
#endif
}
}