angular / angular/angularfire

[docs] Mocking of angularfire methods with angularfire 7 during tests

未关闭
#3,050 4 条评论 9 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
22 小时 28 分钟
30 天内合并 PR
6

描述

### Version info

**Angular:** 12

**Firebase:** 9

**AngularFire:** 7

### How to reproduce these conditions

How to mock firebase operator during tests suits ?
How to write unit tests with mocks of firestore/auth/analytics methods ?

### Expected behavior

With Angularfire 6, I was able to mock angularfire methods like doc, collection and other methods to write my unit tests.
I would like to be able to mock it.

### Actual behavior

I am getting the error during my unit tests :
Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).

贡献指南

打开贡献指南

调研方向

从围绕 AngularFireModule 和 provideFirebaseApp 的 AngularFire 7 测试设置开始,然后在 mock Firestore、Auth 和 Analytics 方法时重现报告的单元测试错误。完成的标准是记录一份在 Angular 12、Firebase 9 和 AngularFire 7 下 mock 这些 AngularFire 方法的可行指南。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, firebase, typescript
领域
documentation, testing
Issue 类型
文档
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。