From e879334b3bec721fae07eba98682282cbe125c0f Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Sat, 2 May 2020 09:53:47 +1000 Subject: [PATCH] Clean up documentation --- .../Utilities}/XCTest+Eventually.swift | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) rename SignalServiceKit/src/{TestUtils => Loki/Utilities}/XCTest+Eventually.swift (53%) diff --git a/SignalServiceKit/src/TestUtils/XCTest+Eventually.swift b/SignalServiceKit/src/Loki/Utilities/XCTest+Eventually.swift similarity index 53% rename from SignalServiceKit/src/TestUtils/XCTest+Eventually.swift rename to SignalServiceKit/src/Loki/Utilities/XCTest+Eventually.swift index 4b4db5ae3..556b342f9 100644 --- a/SignalServiceKit/src/TestUtils/XCTest+Eventually.swift +++ b/SignalServiceKit/src/Loki/Utilities/XCTest+Eventually.swift @@ -2,22 +2,26 @@ import XCTest extension XCTestCase { - /// Simple helper for asynchronous testing. - /// Usage in XCTestCase method: - /// func testSomething() { - /// doAsyncThings() - /// eventually { - /// /* XCTAssert goes here... */ - /// } - /// } - /// Cloure won't execute until timeout is met. You need to pass in an - /// timeout long enough for your asynchronous process to finish, if it's + /// A helper for asynchronous testing. + /// + /// Usage example: + /// + /// ``` + /// func testSomething() { + /// doAsyncThings() + /// eventually { + /// /* XCTAssert goes here... */ + /// } + /// } + /// ``` + /// + /// The provided closure won't execute until `timeout` seconds have passed. Pass + /// in a timeout long enough for your asynchronous process to finish if it's /// expected to take more than the default 0.1 second. /// /// - Parameters: - /// - timeout: amout of time in seconds to wait before executing the - /// closure. - /// - closure: a closure to execute when `timeout` seconds has passed + /// - timeout: number of seconds to wait before executing `closure`. + /// - closure: a closure to execute when `timeout` seconds have passed. func eventually(timeout: TimeInterval = 0.1, closure: @escaping () -> Void) { let expectation = self.expectation(description: "") expectation.fulfillAfter(timeout) @@ -31,7 +35,7 @@ extension XCTestExpectation { /// Call `fulfill()` after some time. /// - /// - Parameter time: amout of time after which `fulfill()` will be called. + /// - Parameter time: number of seconds after which `fulfill()` will be called. func fulfillAfter(_ time: TimeInterval) { DispatchQueue.main.asyncAfter(deadline: .now() + time) { self.fulfill()