Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.76 KB | None | 0 0
  1.  
  2. // ovo ne radi
  3. private func insert(_ data: Data, to sut: SUT) -> Error? {
  4.     let exp = expectation(description: "Wait for cache insertion")
  5.     var insertionError: Error?
  6.     sut.insert(data) { receivedInsertionError in
  7.         insertionError = receivedInsertionError
  8.         exp.fulfill()
  9.     }
  10.     wait(for: [exp], timeout: 3)
  11.     return insertionError
  12. }
  13.  
  14. // ovo radi
  15. private func insert(_ data: Data, to sut: SUT, completion: ((_ error: Error?) -> Void)? = nil){
  16.     let exp = expectation(description: "Wait for cache insertion")
  17.     var insertionError: Error?
  18.     sut.insert(data) { receivedInsertionError in
  19.         insertionError = receivedInsertionError
  20.         exp.fulfill()
  21.     }
  22.     wait(for: [exp], timeout: 3)
  23.     completion?(insertionError)
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement