Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions flutter/example/integration_test/web_sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ void main() {
expect((header['sdk'] as Map<Object?, Object?>)['name'],
'sentry.dart.flutter');

final item = (envelope[1] as List<Object?>).first as List<Object?>;
final itemPayloadJs = (item[1] as JSArray).toDart;
final itemPayload = json.decode(utf8.decoder.convert(itemPayloadJs
.map((el) => int.parse(el.dartify().toString()))
.toList())) as Map<Object?, Object?>;
final item = (envelope[1] as List).first as List<Object?>;
final itemPayload =
json.decode(utf8.decoder.convert(item[1] as List<int>))
as Map<Object?, Object?>;

final jsEventJson = (itemPayload).map((key, value) {
return MapEntry(key.toString(), value as dynamic);
Expand Down
81 changes: 40 additions & 41 deletions flutter/test/web/sentry_web_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,46 @@ void main() {
await sut.close();
});

// TODO: re-enable this test in V9
// test('init: options mapped to JS SDK', () async {
// const expectedDsn = 'https://[email protected]/1234567';
// const expectedRelease = 'my-random-release';
// const expectedSampleRate = 0.2;
// const expectedEnv = 'my-random-env';
// const expectedDist = '999';
// const expectedAttachStacktrace = false;
// const expectedMaxBreadcrumbs = 1000;
// const expectedDebug = true;
//
// options.dsn = expectedDsn;
// options.release = expectedRelease;
// options.sampleRate = expectedSampleRate;
// options.environment = expectedEnv;
// options.dist = expectedDist;
// options.attachStacktrace = expectedAttachStacktrace;
// options.maxBreadcrumbs = expectedMaxBreadcrumbs;
// options.debug = expectedDebug;
//
// // quick check that Sentry is not initialized first
// expect(() => binding.getJsOptions()['dsn'], throwsA(anything));
//
// await sut.init(hub);
//
// final jsOptions = binding.getJsOptions();
//
// expect(jsOptions['dsn'], expectedDsn);
// expect(jsOptions['release'], expectedRelease);
// expect(jsOptions['sampleRate'], expectedSampleRate);
// expect(jsOptions['environment'], expectedEnv);
// expect(jsOptions['dist'], expectedDist);
// expect(jsOptions['attachStacktrace'], expectedAttachStacktrace);
// expect(jsOptions['maxBreadcrumbs'], expectedMaxBreadcrumbs);
// expect(jsOptions['debug'], expectedDebug);
// expect(jsOptions['defaultIntegrations'].length, 2);
// expect(jsOptions['defaultIntegrations'][0].toString(),
// contains('name: GlobalHandlers'));
// expect(jsOptions['defaultIntegrations'][1].toString(),
// contains('name: Dedupe'));
// });
test('init: options mapped to JS SDK', () async {
const expectedDsn = 'https://[email protected]/1234567';
const expectedRelease = 'my-random-release';
const expectedSampleRate = 0.2;
const expectedEnv = 'my-random-env';
const expectedDist = '999';
const expectedAttachStacktrace = false;
const expectedMaxBreadcrumbs = 1000;
const expectedDebug = true;

options.dsn = expectedDsn;
options.release = expectedRelease;
options.sampleRate = expectedSampleRate;
options.environment = expectedEnv;
options.dist = expectedDist;
options.attachStacktrace = expectedAttachStacktrace;
options.maxBreadcrumbs = expectedMaxBreadcrumbs;
options.debug = expectedDebug;

// quick check that Sentry is not initialized first
expect(() => binding.getJsOptions()['dsn'], throwsA(anything));

await sut.init(hub);

final jsOptions = binding.getJsOptions();

expect(jsOptions['dsn'], expectedDsn);
expect(jsOptions['release'], expectedRelease);
expect(jsOptions['sampleRate'], expectedSampleRate);
expect(jsOptions['environment'], expectedEnv);
expect(jsOptions['dist'], expectedDist);
expect(jsOptions['attachStacktrace'], expectedAttachStacktrace);
expect(jsOptions['maxBreadcrumbs'], expectedMaxBreadcrumbs);
expect(jsOptions['debug'], expectedDebug);
expect(jsOptions['defaultIntegrations'].length, 2);
expect(jsOptions['defaultIntegrations'][0].toString(),
contains('name: GlobalHandlers'));
expect(jsOptions['defaultIntegrations'][1].toString(),
contains('name: Dedupe'));
});

test('options getter returns the original options', () {
expect(sut.options, same(options));
Expand Down
Loading