angular / angular/angularfire

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

Đang mở
#3,050 4 bình luận 9 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
7.8k
Fork
2.2k
Merge trung bình
22 giờ 28 phút
Pull request đã merge (30 ngày)
6

Mô tả

### 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).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với thiết lập kiểm thử AngularFire 7 xoay quanh AngularFireModule và provideFirebaseApp, sau đó tái hiện lỗi unit test đã được báo cáo trong khi mock các phương thức của Firestore, Auth và Analytics. Công việc được xem là hoàn tất khi đã ghi lại hướng dẫn hoạt động được về cách mock các phương thức AngularFire này trên Angular 12, Firebase 9 và AngularFire 7.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, firebase, typescript
Lĩnh vực
documentation, testing
Loại issue
Tài liệu
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.