Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ciriousjoker/fake_firebase_performance
Flutter package: Fake Firebase Performance for use during Flutter unit & widget tests.
https://github.com/ciriousjoker/fake_firebase_performance
fake firebase firebase-performance firebase-performance-monitoring flutter-test mock unit-testing
Last synced: about 2 months ago
JSON representation
Flutter package: Fake Firebase Performance for use during Flutter unit & widget tests.
- Host: GitHub
- URL: https://github.com/ciriousjoker/fake_firebase_performance
- Owner: ciriousjoker
- License: bsd-2-clause
- Created: 2022-01-08T08:35:15.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-08T08:43:47.000Z (about 3 years ago)
- Last Synced: 2024-11-15T06:15:55.877Z (2 months ago)
- Topics: fake, firebase, firebase-performance, firebase-performance-monitoring, flutter-test, mock, unit-testing
- Language: Dart
- Homepage: https://pub.dev/packages/fake_firebase_performance
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Fake Firebase Performance
[![pub package](https://img.shields.io/pub/v/fake_firebase_performance.svg)](https://pub.dartlang.org/packages/fake_firebase_performance)
Fakes to write unit tests for apps using Firebase Performance monitoring. Instantiate a `FakeFirebasePerformance`, then pass it around your project to replace `FirebasePerformance.instance`. This fake acts like `FirebasePerformance` except it will load mocked data instead.
## Usage
### A simple usage example
```dart
import 'package:fake_firebase_performance/fake_firebase_performance.dart';void main() async {
final perf = FakeFirebasePerformance();perf.isPerformanceCollectionEnabled(); // will return false
perf.newTrace('test'); // will do nothing
perf.newHttpMetric("https://example.com/", HttpMethod.Get); // will do nothing
}
```This `perf` object needs to replace the real `FirebasePerformance.instance` during testing. You can do this for example with [Riverpod](https://pub.dev/packages/riverpod) or by doing something like this:
```dart
await tester.pumpWidget(
MaterialApp(
title: 'FirebasePerformance Example',
home: MyApp(overrideFirebasePerformance: perf),
),
);
```## Missing functionality
- `perf.app` will throw
- `perf.pluginConstants` is empty
- `perf.newTrace()` does nothing
- `perf.newHttpMetric()` does nothing## Compatibility table
| firebase_performance | fake_firebase_performance |
| -------------------- | ------------------------- |
| >=0.8.0 | 1.0.0 |## Features and bugs
Please file feature requests and bugs at the [issue tracker](https://github.com/CiriousJoker/fake_firebase_performance/issues).