Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ovo ne radi
- private func insert(_ data: Data, to sut: SUT) -> Error? {
- let exp = expectation(description: "Wait for cache insertion")
- var insertionError: Error?
- sut.insert(data) { receivedInsertionError in
- insertionError = receivedInsertionError
- exp.fulfill()
- }
- wait(for: [exp], timeout: 3)
- return insertionError
- }
- // ovo radi
- private func insert(_ data: Data, to sut: SUT, completion: ((_ error: Error?) -> Void)? = nil){
- let exp = expectation(description: "Wait for cache insertion")
- var insertionError: Error?
- sut.insert(data) { receivedInsertionError in
- insertionError = receivedInsertionError
- exp.fulfill()
- }
- wait(for: [exp], timeout: 3)
- completion?(insertionError)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement