Skip to content

Instantly share code, notes, and snippets.

@victorpanitz
Last active August 15, 2020 20:56
Show Gist options
  • Save victorpanitz/043342523d3f68019c256edf27238baa to your computer and use it in GitHub Desktop.
Save victorpanitz/043342523d3f68019c256edf27238baa to your computer and use it in GitHub Desktop.
func test_cancellAllTasks_givenExistsActiveTasks_shouldCancellAllOfThem() {
...
let getTasksExpectation = XCTestExpectation(description: "getTasksExpectation")
var activeTasksCount: Int?
sut.session.getAllTasks { tasks in
activeTasksCount = tasks.count
getTasksExpectation.fulfill()
}
wait(for: [getTasksExpectation], timeout: 0.2)
XCTAssertEqual(activeTasksCount, 2)
sut.cancelAllTasks()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment