我正在尝试遵循Akita
有关单元测试的官方文档Angular
:https ://datorama.github.io/akita/docs/angular/tests/ 。
但是我在模拟TodosQuery
返回值时遇到了问题。这是特定的行:
todosQuery.selectAll.and.returnValue(of([createTodo(), createTodo()]))
这是抛出的错误:
Property 'and' does not exist on type '{ (options: SelectAllOptionsA<Todo>): Observable<HashMap<Todo>>; (options: SelectAllOptionsB<Todo>): Observable<...>; (options: SelectAllOptionsC<...>): Observable<...>; (options: SelectAllOptionsD<...>): Observable<...>; (options: SelectAllOptionsE<...>): Observable<...>; (): Observable<...>; }'.
也许文档已经过时并且不再支持?这仍然是模拟Query
返回值的首选方式吗?
这些是我的 package.json 依赖项:
"dependencies": {
"@angular/animations": "~12.2.0",
"@angular/common": "~12.2.0",
"@angular/compiler": "~12.2.0",
"@angular/core": "~12.2.0",
"@angular/forms": "~12.2.0",
"@angular/platform-browser": "~12.2.0",
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"@datorama/akita": "^6.2.3",
"@datorama/akita-ng-entity-service": "^6.2.0",
"@datorama/akita-ng-router-store": "^6.0.0",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.5",
"@angular/cli": "~12.2.5",
"@angular/compiler-cli": "~12.2.0",
"@datorama/akita-ngdevtools": "^6.0.0",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.3.5"
}