<Description> : Adding test for timer runThisEvery.
<Type> : test
This commit is contained in:
parent
bbfbfa0b1b
commit
64be3cb8da
|
@ -26,5 +26,25 @@ class TimerTests: XCTestCase {
|
|||
XCTAssertTrue(methodCalled)
|
||||
}
|
||||
}
|
||||
|
||||
public func testAfterEveryPositiveCase() {
|
||||
|
||||
let testAfterEveryExpectation = expectation(description: "testAfterDelay")
|
||||
|
||||
var methodCalledTimes = 0
|
||||
|
||||
_ = Timer.runThisEvery(seconds: 1) { (timer) -> Void in
|
||||
methodCalledTimes += 1
|
||||
|
||||
if (methodCalledTimes == 3) {
|
||||
timer?.invalidate()
|
||||
testAfterEveryExpectation.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
self.waitForExpectations(timeout: 10) { completion in
|
||||
XCTAssertEqual(methodCalledTimes, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue