Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a35dad
Move to local dependency
vishnukvmd May 28, 2022
1ba4085
Pass DSN within the SentryEnvelopeHeader
vishnukvmd May 28, 2022
a6fb6c0
Switch to remote dependency as an override is already declared
vishnukvmd Jun 14, 2022
152d32a
Merge branch 'main' into sentry_tunnel
ua741 Sep 27, 2022
3502ee4
Fix broken tests
ua741 Sep 27, 2022
bd69848
Fix test
ua741 Sep 28, 2022
93b03da
fix lint
marandaneto Oct 7, 2022
a6310cb
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
7534e82
fix
marandaneto Oct 7, 2022
647697c
fix tests
marandaneto Oct 7, 2022
0cb505d
pr id
marandaneto Oct 7, 2022
4f8a29c
pr id
marandaneto Oct 7, 2022
441d14f
add tests
marandaneto Oct 7, 2022
7dc6ab3
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
52265fe
fix
marandaneto Oct 7, 2022
78b8b57
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
65df091
Merge branch 'sentry_tunnel' of github.com:getsentry/sentry-dart into…
marandaneto Oct 7, 2022
06fc8cf
remove
marandaneto Oct 7, 2022
64c803f
fix
marandaneto Oct 7, 2022
fa35f2e
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
614334e
move bytes to file
marandaneto Oct 7, 2022
3b552e2
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
0742cde
Merge branch 'sentry_tunnel' of github.com:getsentry/sentry-dart into…
marandaneto Oct 7, 2022
9cd0ac9
test
marandaneto Oct 7, 2022
a33faf9
Merge branch 'main' into sentry_tunnel
marandaneto Oct 7, 2022
a0ef68c
lf fix
marandaneto Oct 7, 2022
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
add tests
  • Loading branch information
marandaneto committed Oct 7, 2022
commit 441d14fee1953e6e6ae8b02269dcad37abf940db
34 changes: 34 additions & 0 deletions dart/test/sentry_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ void main() {

expect(capturedEvent.threads?.first.stacktrace, isNull);
});

test('event envelope contains dsn', () async {
final client = fixture.getSut();
final event = SentryEvent();
await client.captureEvent(event);

final capturedEnvelope = (fixture.transport).envelopes.first;

expect(capturedEnvelope.header.dsn, fixture.options.dsn);
});
});

group('SentryClient captures exception', () {
Expand Down Expand Up @@ -468,6 +478,16 @@ void main() {

expect(id, SentryId.empty());
});

test('transaction envelope contains dsn', () async {
final client = fixture.getSut();
final tr = SentryTransaction(fixture.tracer);
await client.captureTransaction(tr);

final capturedEnvelope = (fixture.transport).envelopes.first;

expect(capturedEnvelope.header.dsn, fixture.options.dsn);
});
});

group('SentryClient : apply scope to the captured event', () {
Expand Down Expand Up @@ -1193,6 +1213,20 @@ void main() {
expect(fixture.recorder.reason, DiscardReason.sampleRate);
expect(fixture.recorder.category, DataCategory.error);
});

test('user feedback envelope contains dsn', () async {
final client = fixture.getSut();
final event = SentryEvent();
final feedback = SentryUserFeedback(
eventId: event.eventId,
name: 'test',
);
await client.captureUserFeedback(feedback);

final capturedEnvelope = (fixture.transport).envelopes.first;

expect(capturedEnvelope.header.dsn, fixture.options.dsn);
});
});
}

Expand Down
4 changes: 4 additions & 0 deletions dart/test/sentry_envelope_header_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'package:sentry/sentry.dart';
import 'package:sentry/src/sentry_envelope_header.dart';
import 'package:test/test.dart';

import 'mocks.dart';

void main() {
group('SentryEnvelopeHeader', () {
test('toJson empty', () {
Expand All @@ -23,13 +25,15 @@ void main() {
final sut = SentryEnvelopeHeader(
eventId,
sdkVersion,
dsn: fakeDsn,
traceContext: context,
);
final expextedSkd = sdkVersion.toJson();
final expected = <String, dynamic>{
'event_id': eventId.toString(),
'sdk': expextedSkd,
'trace': context.toJson(),
'dsn': fakeDsn,
};
expect(sut.toJson(), expected);
});
Expand Down
5 changes: 2 additions & 3 deletions dart/test/sentry_envelope_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void main() {
'trace_id': '${SentryId.newId()}',
'public_key': '123',
});
final fakeDsn = 'https://[email protected]/1234567';
final sut = SentryEnvelope.fromEvent(
sentryEvent,
sdkVersion,
Expand All @@ -78,6 +77,7 @@ void main() {
expect(sut.header.eventId, eventId);
expect(sut.header.sdkVersion, sdkVersion);
expect(sut.header.traceContext, context);
expect(sut.header.dsn, fakeDsn);
expect(sut.items[0].header.contentType,
expectedEnvelopeItem.header.contentType);
expect(sut.items[0].header.type, expectedEnvelopeItem.header.type);
Expand Down Expand Up @@ -117,6 +117,7 @@ void main() {
expect(sut.header.eventId, tr.eventId);
expect(sut.header.sdkVersion, sdkVersion);
expect(sut.header.traceContext, traceContext);
expect(sut.header.dsn, fakeDsn);
expect(sut.items[0].header.contentType,
expectedEnvelopeItem.header.contentType);
expect(sut.items[0].header.type, expectedEnvelopeItem.header.type);
Expand All @@ -140,7 +141,6 @@ void main() {
final sentryEvent = SentryEvent(eventId: eventId);
final sdkVersion =
SdkVersion(name: 'fixture-name', version: 'fixture-version');
final fakeDsn = 'https://[email protected]/1234567';

final sut = SentryEnvelope.fromEvent(
sentryEvent,
Expand Down Expand Up @@ -172,7 +172,6 @@ void main() {
// This is a test for https://github.com/getsentry/sentry-dart/issues/523
test('serialize with non-serializable class', () async {
final event = SentryEvent(extra: {'non-ecodable': NonEncodable()});
final fakeDsn = 'https://[email protected]/1234567';
final sut = SentryEnvelope.fromEvent(
event,
SdkVersion(
Expand Down
1 change: 1 addition & 0 deletions dart/test/sentry_user_feedback_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void main() {
SentryItemType.userFeedback,
);
expect(envelope.header.eventId.toString(), feedback.eventId.toString());
expect(envelope.header.dsn, fakeDsn);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import 'package:sentry/src/sentry_tracer.dart';
import '../mocks.dart';
import '../mocks.mocks.dart';

const fakeDsn = 'https://[email protected]/1234567';

void main() {
group('$NativeAppStartIntegration', () {
late Fixture fixture;
Expand Down