9dots-firebase-mock 中文文档教程
Firebase Mock
Firebase Mock 扩展 mockfirebase 为以下 Firebase Javascript SDKS 提供支持:
Setup
npm install firebase-mock --save-dev
按照 设置教程 创建一个模拟 SDK 以用于您的测试。 然后根据您的测试框架遵循以下教程之一:
API
Firebase Mock 支持客户端 JavaScript API 和服务器端 Admin API 加上在 API 参考。 Firebase Mock 不是进行实际上异步的服务器调用,而是允许您以指定的延迟同步或异步触发回调 (ref.flush< /代码>
)。
Tutorials
Client (firebase)
- Authentication
- Basic
- JWT Tokens
- Realtime Database
- Basic
- Simulating Errors
- Ordering
- Firestore
- Storage
Admin (firebase-admin)
- Authentication
- Basic
- JWT Tokens
- Realtime Database
- Firestore
- Storage
Functions (firebase-functions)
Alternatives
Firebase Mock
Firebase Mock extends mockfirebase to provide support for the following Firebase Javascript SDKS:
Setup
npm install firebase-mock --save-dev
Follow the steps in the Setup Tutorial to create a mock SDK to be used in your tests. Then follow one of the tutorials below based on your testing framework:
API
Firebase Mock supports the client-side JavaScript API and server-side Admin API plus a small set of utility methods documented fully in the API Reference. Rather than make a server call that is actually asynchronous, Firebase Mock allows you to either trigger callbacks synchronously or asynchronously with a specified delay (ref.flush
).
Tutorials
Client (firebase)
- Authentication
- Basic
- JWT Tokens
- Realtime Database
- Basic
- Simulating Errors
- Ordering
- Firestore
- Storage
Admin (firebase-admin)
- Authentication
- Basic
- JWT Tokens
- Realtime Database
- Firestore
- Storage