test(fdc): add e2e and unit tests to fdc - #13224
Conversation
This reverts commit 6a643f1.
russellwheatley
left a comment
There was a problem hiding this comment.
Some minor feedback but it's looking good to me 👍
| - 'docs/**' | ||
| - 'website/**' | ||
| - '**/example/**' | ||
| - '**/flutterfire_ui/**' |
There was a problem hiding this comment.
| - '**/flutterfire_ui/**' |
| path: | | ||
| ~/.android/avd/* | ||
| ~/.android/adb* | ||
| key: avd-ubuntu |
There was a problem hiding this comment.
| key: avd-ubuntu | |
| key: avd-${{ runner.os }} |
| - uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 | ||
| name: Xcode Compile Cache | ||
| with: | ||
| key: ${{ runner.os }}-ios-fdc-v3 |
There was a problem hiding this comment.
| key: ${{ runner.os }}-ios-fdc-v3 | |
| key: xcode-cache-${{ runner.os }} |
| final listener = MoviesConnector.instance.listMovies | ||
| .ref() | ||
| .subscribe() | ||
| .listen((value) { | ||
| final movies = value.data.movies; | ||
|
|
||
| if (count == 0) { | ||
| expect(movies.length, 0, | ||
| reason: 'First emission should contain an empty list'); | ||
| } else { | ||
| expect(movies.length, 1, | ||
| reason: 'Second emission should contain one movie'); | ||
| expect(movies[0].title, 'The Matrix', | ||
| reason: 'The movie should be The Matrix'); | ||
| hasBeenListened = true; | ||
| } | ||
| count++; | ||
| }); | ||
|
|
||
| await Future.delayed(const Duration(seconds: 1)); | ||
|
|
||
| await MoviesConnector.instance.createMovie | ||
| .ref( | ||
| genre: 'Action', | ||
| title: 'The Matrix', | ||
| releaseYear: 1999, | ||
| rating: 4.5, | ||
| ) | ||
| .execute(); | ||
|
|
||
| await MoviesConnector.instance.listMovies.ref().execute(); | ||
|
|
||
| await Future.delayed(const Duration(seconds: 1)); |
There was a problem hiding this comment.
Worth using Completers for this type of test: https://github.com/firebase/flutterfire/blob/spm-core-2/tests/integration_test/firebase_storage/task_e2e.dart#L136-L163
It means you don't have to use Future.delayed which could be flakey
| group( | ||
| '$FirebaseDataConnect.instance listen', | ||
| () { | ||
| // ignore: unused_local_variable |
There was a problem hiding this comment.
I don't think this is still needed if it is used?
| group( | ||
| '$FirebaseDataConnect.instance query', | ||
| () { | ||
| // ignore: unused_local_variable |
| # The following line prevents the package from being accidentally published to | ||
| # pub.dev using `flutter pub publish`. This is preferred for private packages. | ||
| publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||
| description: 'A new Flutter project.' |
There was a problem hiding this comment.
| description: 'A new Flutter project.' | |
| description: 'Firebase Data Connect example app' |
| late MockFirebaseAuth mockAuth; | ||
| late MockFirebaseAppCheck mockAppCheck; | ||
| late MockConnectorConfig mockConnectorConfig; | ||
| // ignore: unused_local_variable |
There was a problem hiding this comment.
| // ignore: unused_local_variable |
I guess this can also be removed
| DeleteMovieMovieDelete.fromJson(Map<String, dynamic> json) | ||
| : id = json['id'] {} | ||
|
|
||
| // TODO(mtewani): Fix up to create a map on the fly |
There was a problem hiding this comment.
Are these todos relevant btw?
There was a problem hiding this comment.
These todos are generated when using the VSCode extension, so nothing we can directly do in this repository.
Description
Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change.
Related Issues
#13063
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]).This will ensure a smooth and quick review process. Updating the
pubspec.yamland changelogs is not required.///).melos run analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?