Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run melos format ci
  • Loading branch information
deepak786 committed Jan 28, 2026
commit 9ab032d7af1fa25b7966b8b4bbef063b09a06f4d
Original file line number Diff line number Diff line change
Expand Up @@ -129,32 +129,37 @@ void main() {
await subscription.cancel();
});

test('fires once on first initialization of FirebaseAuth', () async {
// Fixes a very specific bug: https://github.com/firebase/flutterfire/issues/3628
// If the first initialization of FirebaseAuth involves the listeners userChanges() or idTokenChanges()
// the user will receive two events. Why? The native SDK listener will always fire an event upon initial
// listen. FirebaseAuth also sends an initial synthetic event. We send a synthetic event because, ordinarily, the user will
// not use a listener as the first occurrence of FirebaseAuth. We, therefore, mimic native behavior by sending an
// event. This test proves the logic of PR: https://github.com/firebase/flutterfire/pull/6560

// Requires a fresh app.
FirebaseApp second = await Firebase.initializeApp(
name: 'test-init',
options: DefaultFirebaseOptions.currentPlatform,
);
test(
'fires once on first initialization of FirebaseAuth',
() async {
// Fixes a very specific bug: https://github.com/firebase/flutterfire/issues/3628
// If the first initialization of FirebaseAuth involves the listeners userChanges() or idTokenChanges()
// the user will receive two events. Why? The native SDK listener will always fire an event upon initial
// listen. FirebaseAuth also sends an initial synthetic event. We send a synthetic event because, ordinarily, the user will
// not use a listener as the first occurrence of FirebaseAuth. We, therefore, mimic native behavior by sending an
// event. This test proves the logic of PR: https://github.com/firebase/flutterfire/pull/6560

// Requires a fresh app.
FirebaseApp second = await Firebase.initializeApp(
name: 'test-init',
options: DefaultFirebaseOptions.currentPlatform,
);

Stream<User?> stream =
FirebaseAuth.instanceFor(app: second).userChanges();
Stream<User?> stream =
FirebaseAuth.instanceFor(app: second).userChanges();

subscription = stream.listen(
expectAsync1(
(User? user) {},
reason: 'Stream should only call once',
),
);
subscription = stream.listen(
expectAsync1(
(User? user) {},
reason: 'Stream should only call once',
),
);

await Future.delayed(const Duration(seconds: 2));
}, skip: defaultTargetPlatform == TargetPlatform.macOS || defaultTargetPlatform == TargetPlatform.windows,);
await Future.delayed(const Duration(seconds: 2));
},
skip: defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.windows,
);

test(
'calls callback with the current user and when user state changes',
Expand Down Expand Up @@ -868,7 +873,8 @@ void main() {
}
});
},
skip: defaultTargetPlatform == TargetPlatform.macOS || defaultTargetPlatform == TargetPlatform.windows,
skip: defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.windows,
);

group(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,25 @@ void main() {
test(
'should have consistent error reason format',
() async {
const eventChannel = EventChannel('plugins.flutter.io/firebase_crashlytics_test_stream');
final eventStream = eventChannel.receiveBroadcastStream();
const eventChannel = EventChannel(
'plugins.flutter.io/firebase_crashlytics_test_stream');
final eventStream = eventChannel.receiveBroadcastStream();

final completer = Completer<String>();
final completer = Completer<String>();

final subscription = eventStream.listen((event) {
completer.complete(event.toString());
});
final subscription = eventStream.listen((event) {
completer.complete(event.toString());
});

await FirebaseCrashlytics.instance.recordError(
'foo exception',
StackTrace.fromString('during testing'),
reason: 'foo reason',
);
await FirebaseCrashlytics.instance.recordError(
'foo exception',
StackTrace.fromString('during testing'),
reason: 'foo reason',
);

final event = await completer.future;
expect(event, 'thrown foo reason');
await subscription.cancel();
final event = await completer.future;
expect(event, 'thrown foo reason');
await subscription.cancel();
},
skip: kIsWeb || defaultTargetPlatform == TargetPlatform.macOS,
);
Expand Down
18 changes: 8 additions & 10 deletions tests/integration_test/firebase_storage/task_e2e.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ void setupTaskTests() {
retry: 3,
// TODO(russellwheatley): Windows works on example app, but fails on tests.
// Clue is in bytesTransferred + totalBytes which both equal: -3617008641903833651
skip: !kIsWeb && (
defaultTargetPlatform == TargetPlatform.windows ||
defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.macOS
),
skip: !kIsWeb &&
(defaultTargetPlatform == TargetPlatform.windows ||
defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.macOS),
);

// TODO(Salakar): Test is flaky on CI - needs investigating ('[firebase_storage/unknown] An unknown error occurred, please check the server response.')
Expand All @@ -127,11 +126,10 @@ void setupTaskTests() {
// This task is flaky on mac, skip for now.
// TODO(russellwheatley): Windows works on example app, but fails on tests.
// Clue is in bytesTransferred + totalBytes which both equal: -3617008641903833651
skip: !kIsWeb && (
defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.windows ||
defaultTargetPlatform == TargetPlatform.android
),
skip: !kIsWeb &&
(defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.windows ||
defaultTargetPlatform == TargetPlatform.android),
);

test(
Expand Down