mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 00:30:51 +01:00
27 lines
714 B
Swift
27 lines
714 B
Swift
//
|
|
// TestGetEntriesService.swift
|
|
// AccountTests
|
|
//
|
|
// Created by Kiel Gillard on 11/1/20.
|
|
// Copyright © 2020 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import Account
|
|
|
|
final class TestGetEntriesService: FeedlyGetEntriesService {
|
|
var mockResult: Result<[FeedlyEntry], Error>?
|
|
var getEntriesExpectation: XCTestExpectation?
|
|
|
|
func getEntries(for ids: Set<String>, completion: @escaping (Result<[FeedlyEntry], Error>) -> ()) {
|
|
guard let result = mockResult else {
|
|
XCTFail("Missing mock result. Test may time out because the completion will not be called.")
|
|
return
|
|
}
|
|
DispatchQueue.main.async {
|
|
completion(result)
|
|
self.getEntriesExpectation?.fulfill()
|
|
}
|
|
}
|
|
}
|