I hope all is well and you are enjoying WWDC 2020 online. I have a question. I am using the pod 'Resolver' for dependency injection. It is working great. Until I write my unit tests to test my view models. I get this crash:
public final func resolve<Service>(_ type: Service.Type = Service.self, name: String? = nil, args: Any? = nil) -> Service {
if let registration = lookup(type, name: name ?? NONAME),
let service = registration.scope.resolve(resolver: self, registration: registration, args: args) {
return service
}
print("RESOLVER: '\(Service.self):\(name ?? "")' not resolved. To disambiguate optionals use resover.optional().")
fatalError()
}
The test:
import XCTest
import Resolver
class QuizRowViewModelModelTests: XCTestCase {
@Published var quizRepository: QuizRepository = Resolver.resolve()
I have debugged the section where it sets QuizRepository and this works fine.
register { TestDataQuizRepository() as QuizRepository }.scope(application)
Do you happen to have any idea as to why this would happen?
Thanks a million