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 test
  • Loading branch information
marandaneto committed Oct 20, 2020
commit 667fa8798967b4eee6fb641bcddcbeb2760e2663
2 changes: 0 additions & 2 deletions dart/test/event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ void main() {

final error = StateError('test-error');

print('error.stackTrace ${error.stackTrace}');

expect(
Event(
eventId: SentryId.empty(),
Expand Down
12 changes: 8 additions & 4 deletions dart/test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Future testCaptureException(
fail('Unexpected request on ${request.method} ${request.url} in HttpMock');
});

var sentryId = SentryId.empty();
final client = SentryClient(
SentryOptions(
dsn: testDsn,
Expand All @@ -86,8 +87,7 @@ Future testCaptureException(
try {
throw ArgumentError('Test error');
} catch (error, stackTrace) {
final sentryId =
await client.captureException(error, stackTrace: stackTrace);
sentryId = await client.captureException(error, stackTrace: stackTrace);
expect('$sentryId', 'testeventid');
}

Expand All @@ -107,6 +107,10 @@ Future testCaptureException(
} else {
data = json.decode(utf8.decode(body)) as Map<String, dynamic>;
}

// so we assert the generated and returned id
data['event_id'] = sentryId.toString();

final stacktrace = data.remove('stacktrace') as Map<String, dynamic>;

expect(stacktrace['frames'], const TypeMatcher<List>());
Expand Down Expand Up @@ -138,7 +142,7 @@ Future testCaptureException(

expect(data, {
'project': '1',
'event_id': SentryId.empty().toString(),
'event_id': sentryId.toString(),
'timestamp': '2017-01-02T00:00:00',
'platform': 'javascript',
'sdk': {'version': sdkVersion, 'name': 'sentry.dart'},
Expand All @@ -156,7 +160,7 @@ Future testCaptureException(

expect(data, {
'project': '1',
'event_id': SentryId.empty().toString(),
'event_id': sentryId.toString(),
'timestamp': '2017-01-02T00:00:00',
'platform': 'dart',
'exception': [
Expand Down