Skip to content

Commit

Permalink
Set in own group
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Jul 30, 2024
1 parent 71c4af9 commit 1673a1c
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions flutter/test/sentry_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -666,43 +666,45 @@ void main() {
await expectLater(SentryFlutter.pauseAppHangTracking(), completes);
});

test(
'should add DartExceptionTypeIdentifier and FlutterExceptionTypeIdentifier by default',
() async {
SentryOptions? actualOptions;
await SentryFlutter.init(
(options) {
options.dsn = fakeDsn;
options.automatedTestMode = true;
actualOptions = options;
},
appRunner: appRunner,
platformChecker: getPlatformChecker(
platform: MockPlatform.android(),
isWeb: true,
),
);

expect(actualOptions!.exceptionTypeIdentifiers.length, 2);
// Flutter identifier should be first as it's more specific
expect(
actualOptions!.exceptionTypeIdentifiers.first,
isA<CachingExceptionTypeIdentifier>().having(
(c) => c.identifier,
'wrapped identifier',
isA<FlutterExceptionTypeIdentifier>(),
),
);
expect(
actualOptions!.exceptionTypeIdentifiers[1],
isA<CachingExceptionTypeIdentifier>().having(
(c) => c.identifier,
'wrapped identifier',
isA<DartExceptionTypeIdentifier>(),
),
);

await Sentry.close();
group('exception identifiers', () {
test(
'should add DartExceptionTypeIdentifier and FlutterExceptionTypeIdentifier by default',
() async {
SentryOptions? actualOptions;
await SentryFlutter.init(
(options) {
options.dsn = fakeDsn;
options.automatedTestMode = true;
actualOptions = options;
},
appRunner: appRunner,
platformChecker: getPlatformChecker(
platform: MockPlatform.android(),
isWeb: true,
),
);

expect(actualOptions!.exceptionTypeIdentifiers.length, 2);
// Flutter identifier should be first as it's more specific
expect(
actualOptions!.exceptionTypeIdentifiers.first,
isA<CachingExceptionTypeIdentifier>().having(
(c) => c.identifier,
'wrapped identifier',
isA<FlutterExceptionTypeIdentifier>(),
),
);
expect(
actualOptions!.exceptionTypeIdentifiers[1],
isA<CachingExceptionTypeIdentifier>().having(
(c) => c.identifier,
'wrapped identifier',
isA<DartExceptionTypeIdentifier>(),
),
);

await Sentry.close();
});
});
}

Expand Down

0 comments on commit 1673a1c

Please sign in to comment.