Stub onion request path building test

pull/148/head
gmbnt 4 years ago
parent b8a1a3c63e
commit 1b31432de9

@ -1,8 +1,8 @@
import PromiseKit
internal enum OnionRequestAPI {
private static let workQueue = DispatchQueue.global() // TODO: We should probably move away from using the global queue for this
/// - Note: Exposed for testing purposes.
internal static let workQueue = DispatchQueue.global() // TODO: We should probably move away from using the global queue for this
internal static var guardSnodes: Set<LokiAPITarget> = []
internal static var paths: Set<Path> = []

@ -2,5 +2,19 @@
import XCTest
class OnionRequestAPITests : XCTestCase {
private let maxRetryCount: UInt = 2 // Be a bit more stringent when testing
// TODO: Remove dependency on SSKEnvironment
func testGetPath() {
let semaphore = DispatchSemaphore(value: 0)
var error: Error? = nil
let _ = OnionRequestAPI.getPath().retryingIfNeeded(maxRetryCount: maxRetryCount).done(on: OnionRequestAPI.workQueue) { _ in
semaphore.signal()
}.catch(on: OnionRequestAPI.workQueue) {
error = $0; semaphore.signal()
}
semaphore.wait()
XCTAssert(error == nil)
}
}

Loading…
Cancel
Save