Skip to content

Commit

Permalink
Merge pull request #403 from somia/fix/testing
Browse files Browse the repository at this point in the history
Fix/testing
  • Loading branch information
andreiqvik authored Oct 26, 2023
2 parents 8644d3f + 58727ab commit d58e401
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import Foundation
extension Thread {
/// Taken from `https://stackoverflow.com/a/59732115/7264553`
var isRunningXCTests: Bool {
self.threadDictionary.allKeys.compactMap({ $0 as? String }).filter({ $0.split(separator: ".").contains("xctest") }).count > 0
let allKeys = self.threadDictionary.allKeys
let stringKeys = allKeys.compactMap({ $0 as? String })
let hasXCTestContextKey = stringKeys.contains("kXCTContextStackThreadKey")
let hasXCTestSubstring = stringKeys.contains(where: { $0.split(separator: ".").contains("xctest") })
return hasXCTestContextKey || hasXCTestSubstring
}
}
2 changes: 1 addition & 1 deletion NinchatSDKSwiftTests/CoordinatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CoordinatorTests: XCTestCase {
override func setUp() {
let config = SiteConfigurationImpl(configuration: try! openAsset(forResource: "site-configuration-mock"), environments: ["fi-restart", "fi"])
(session.sessionManager as? NINChatSessionManagerImpl)?.setSiteConfiguration(config)
coordinator = NINCoordinator(with: session.sessionManager, delegate: session) { }
coordinator = NINCoordinator(with: session.sessionManager, delegate: session, modalPresentationStyle: .fullScreen) { }
}

override func tearDown() { }
Expand Down

0 comments on commit d58e401

Please sign in to comment.