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
fix broken tests
  • Loading branch information
marandaneto committed Oct 19, 2020
commit 4c3f323ac77920f89aec8a814b42b9842b0ab7dd
6 changes: 4 additions & 2 deletions dart/test/hub_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ void main() {
test('should capture exception', () {
hub.captureException(fakeException);

verify(client.captureException(fakeException)).called(1);
verify(client.captureException(fakeException, scope: anyNamed('scope')))
.called(1);
});

test('should capture message', () {
hub.captureMessage(fakeMessage.formatted, level: SeverityLevel.info);
verify(
client.captureMessage(fakeMessage.formatted, level: SeverityLevel.info),
client.captureMessage(fakeMessage.formatted,
level: SeverityLevel.info, scope: anyNamed('scope')),
).called(1);
});
});
Expand Down
3 changes: 2 additions & 1 deletion dart/test/sentry_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ void main() {
test('should capture the exception', () async {
await Sentry.captureException(anException);
verify(
client.captureException(anException, stackTrace: null),
client.captureException(anException,
stackTrace: null, scope: anyNamed('scope')),
).called(1);
});
});
Expand Down
11 changes: 5 additions & 6 deletions dart/test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Future testCaptureException(
} catch (error, stackTrace) {
final sentryId =
await client.captureException(error, stackTrace: stackTrace);
expect('$sentryId', 'test-event-id');
expect('$sentryId', 'testeventid');
}

expect(postUri, client.postUri);
Expand All @@ -106,8 +106,7 @@ Future testCaptureException(
} else {
data = json.decode(utf8.decode(body)) as Map<String, dynamic>;
}
final stacktrace =
data.remove('stacktrace') as Map<String, dynamic>;
final stacktrace = data.remove('stacktrace') as Map<String, dynamic>;

expect(stacktrace['frames'], const TypeMatcher<List>());
expect(stacktrace['frames'], isNotEmpty);
Expand Down Expand Up @@ -222,7 +221,7 @@ void runTest({Codec<List<int>, List<int>> gzip, bool isWeb = false}) {
final httpMock = MockClient((Request request) async {
if (request.method == 'POST') {
headers = request.headers;
return Response('{"id": "test-event-id"}', 200);
return Response('{"id": "testeventid"}', 200);
}
fail(
'Unexpected request on ${request.method} ${request.url} in HttpMock');
Expand All @@ -246,7 +245,7 @@ void runTest({Codec<List<int>, List<int>> gzip, bool isWeb = false}) {
} catch (error, stackTrace) {
final sentryId =
await client.captureException(error, stackTrace: stackTrace);
expect('$sentryId', 'test-event-id');
expect('$sentryId', 'testeventid');
}

testHeaders(
Expand Down Expand Up @@ -302,7 +301,7 @@ void runTest({Codec<List<int>, List<int>> gzip, bool isWeb = false}) {
} catch (error, stackTrace) {
final sentryId =
await client.captureException(error, stackTrace: stackTrace);
expect('$sentryId', SentryId.empty());
expect('$sentryId', '00000000000000000000000000000000');
}

await client.close();
Expand Down