Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Mar 6, 2024
1 parent e0298fe commit 7e8478c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion flutter/lib/src/navigation/sentry_navigator_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ class SentryNavigatorObserver extends RouteObserver<PageRoute<dynamic>> {
Future<void> _startTimeToDisplayTracking(Route<dynamic>? route) async {
_completedDisplayTracking = Completer<void>();
String? routeName = _currentRouteName;

if (routeName == null) return;

DateTime startTimestamp = _hub.options.clock();
Expand Down
12 changes: 11 additions & 1 deletion flutter/test/sentry_navigator_observer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_flutter/src/integrations/integrations.dart';
import 'package:sentry_flutter/src/native/sentry_native.dart';
import 'package:sentry/src/sentry_tracer.dart';
import 'package:sentry_flutter/src/navigation/time_to_display_tracker.dart';
Expand Down Expand Up @@ -383,8 +384,15 @@ void main() {
verify(span.setData('route_settings_arguments', arguments));
});

test('flutter root name is replaced', () {
test('flutter root name is replaced', () async {
final rootRoute = route(RouteSettings(name: '/'));
NativeAppStartIntegration.setAppStartInfo(
AppStartInfo(
AppStartType.cold,
start: DateTime.now().add(const Duration(seconds: 1)),
end: DateTime.now().add(const Duration(seconds: 2)),
),
);

final hub = _MockHub();
final span = getMockSentryTracer(name: '/');
Expand All @@ -401,6 +409,8 @@ void main() {

sut.didPush(rootRoute, null);

await Future<void>.delayed(const Duration(milliseconds: 100));

final context = verify(hub.startTransactionWithContext(
captureAny,
waitForChildren: true,
Expand Down

0 comments on commit 7e8478c

Please sign in to comment.