30 lines
956 B
Swift
30 lines
956 B
Swift
|
//
|
||
|
// TestGetStreamIdsService.swift
|
||
|
// AccountTests
|
||
|
//
|
||
|
// Created by Kiel Gillard on 29/10/19.
|
||
|
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import XCTest
|
||
|
@testable import Account
|
||
|
|
||
|
final class TestGetStreamIdsService: FeedlyGetStreamIdsService {
|
||
|
|
||
|
var mockResult: Result<FeedlyStreamIds, Error>?
|
||
|
var parameterTester: ((FeedlyResourceId, String?, Date?, Bool?) -> ())?
|
||
|
var getStreamIdsExpectation: XCTestExpectation?
|
||
|
|
||
|
func getStreamIds(for resource: FeedlyResourceId, continuation: String?, newerThan: Date?, unreadOnly: Bool?, completionHandler: @escaping (Result<FeedlyStreamIds, Error>) -> ()) {
|
||
|
guard let result = mockResult else {
|
||
|
XCTFail("Missing mock result. Test may time out because the completion will not be called.")
|
||
|
return
|
||
|
}
|
||
|
parameterTester?(resource, continuation, newerThan, unreadOnly)
|
||
|
DispatchQueue.main.async {
|
||
|
completionHandler(result)
|
||
|
self.getStreamIdsExpectation?.fulfill()
|
||
|
}
|
||
|
}
|
||
|
}
|