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
Refactor test stubs to fixture and fix tests broken by `useSentryUser…
…` feature
  • Loading branch information
inti7ary committed Aug 18, 2025
commit a9f3057323021c7184bce18a8d915dc6c6f271a9
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ void main() {
final mockBinding = MockSentryNativeBinding();
when(mockBinding.supportsReplay).thenReturn(true);
when(fixture.hub.scope).thenReturn(fixture.scope);
when(fixture.hub.configureScope(any)).thenAnswer((invocation) {
final callback = invocation.positionalArguments.first;
callback(fixture.scope);
return null;
});

final replayId = SentryId.fromId('1988bb1b6f0d4c509e232f0cb9aaeaea');
when(mockBinding.captureReplay()).thenAnswer((_) async => replayId);

Expand Down Expand Up @@ -768,7 +764,11 @@ class Fixture {
hint: anyNamed('hint'),
withScope: anyNamed('withScope'),
)).thenAnswer((_) async => SentryId.empty());

when(hub.configureScope(any)).thenAnswer((invocation) {
final callback = invocation.positionalArguments.first;
callback(scope);
return null;
});
SentryFeedbackWidget.pendingAssociatedEventId = null;
SentryFeedbackWidget.clearPreservedData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ void main() {
options.navigatorKey = navigatorKey;

var hub = mocks.MockHub();
late var scope = Scope(options);

when(hub.options).thenReturn(options);
when(hub.configureScope(any)).thenAnswer((invocation) {
final callback = invocation.positionalArguments.first;
callback(scope);
return null;
});

await tester.pumpWidget(
MaterialApp(
Expand Down