I wrote a test to check if a function was called:
func test_getTaskLists_doNotCreateOrUpdateTaskListToStorageWhenSynchedLocally() { ... let (datasource, restAPI, fakeTaskListStorage) = ... datasource.getTaskLists() { (taskLists, error) -> Void in ... XCTAssertEqual(1, fakeTaskListStorage.readAllInvocationCount) ... } ... }
The function is tricked to bypass the super implementation, and the problem is that the function returns results that I cannot understand, to build / mock, to return a valid object, so that the compiler stops complaining ... I know that I can just call super.readAll (), but here I actually want to convert my test data (fakeTaskLists) to a fake Result object so everyone is happy ... not sure if this is possible
class FakeTaskListsStorageRealm : TaskListStorageRealm { var fakeTaskLists:[TaskList]? override func readAll() -> RealmSwift.Results<TaskList> { readAllInvocationCount += 1
source share