尝试测试服务时出现错误,错误详细信息-
错误:StaticInjectorError(DynamicTestModule)[InjectionToken 环境]:StaticInjectorError(平台:核心)[InjectionToken 环境]: NullInjectorError:没有用于InjectionToken环境的提供程序!
不确定我要去哪里哪里
我尝试了导入HttpClientTestingModule,但没有成功,给出了代码的详细信息。任何帮助将不胜感激。谢谢。
Service.spec.ts文件-
var match = Aggregation.match(Criteria.where("address.location").withinSphere(Circle(latitude, longitude, radius / 6371)))
var project = Aggregation.project("cocktail")
var unwind = Aggregation.unwind("cocktail")
var group = Aggregation.group("cocktail")
var lookup = Aggregation.lookup("your cocktail collection name","_id.cocktail","id","cocktailCollection")
var project1 = Aggregation.project("cocktailCollection.name").andExclude("_id")
var aggregation = Aggregation.newAggregation(match,project,unwind,group,lookup,project1)
println(aggregation) // if you want to see the query
var result = mongoTemplate.aggregate(aggregation,String::class.java)
我遇到上述错误,不确定现在该怎么办。
角度单元测试用例失败,并显示“ NullInjectorError:InjectionToken环境没有提供者!”测试服务为真时出错