2019-10-18 23:21:02 +02:00
|
|
|
//
|
|
|
|
// TestGetCollectionsService.swift
|
|
|
|
// AccountTests
|
|
|
|
//
|
|
|
|
// Created by Kiel Gillard on 30/10/19.
|
|
|
|
// Copyright © 2019 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
@testable import Account
|
|
|
|
|
|
|
|
final class TestGetCollectionsService: FeedlyGetCollectionsService {
|
|
|
|
var mockResult: Result<[FeedlyCollection], Error>?
|
|
|
|
var getCollectionsExpectation: XCTestExpectation?
|
|
|
|
|
2019-12-15 01:14:55 +01:00
|
|
|
func getCollections(completion: @escaping (Result<[FeedlyCollection], Error>) -> ()) {
|
2019-10-18 23:21:02 +02:00
|
|
|
guard let result = mockResult else {
|
|
|
|
XCTFail("Missing mock result. Test may time out because the completion will not be called.")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
DispatchQueue.main.async {
|
2019-12-15 01:14:55 +01:00
|
|
|
completion(result)
|
2019-10-18 23:21:02 +02:00
|
|
|
self.getCollectionsExpectation?.fulfill()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|