Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

beforeBreadcrumb was not adding the mutated breadcrumb #982

Merged
merged 5 commits into from Aug 17, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Fixes

* Scope.clone incorrectly accesses tags ([#978](https://github.com/getsentry/sentry-dart/pull/978))
* beforeBreadcrumb was not adding the mutated breadcrumb ([#982](https://github.com/getsentry/sentry-dart/pull/982))

### Features

- Bump Cocoa SDK to v7.23.0 ([#968](https://github.com/getsentry/sentry-dart/pull/968))
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/scope.dart
Expand Up @@ -194,7 +194,7 @@ class Scope {
_breadcrumbs.removeFirst();
}

_breadcrumbs.add(breadcrumb);
_breadcrumbs.add(processedBreadcrumb);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion dart/test/http_client/tracing_client_test.dart
Expand Up @@ -154,7 +154,7 @@ class Fixture {
MockClient getClient({int statusCode = 200, String? reason}) {
return MockClient((request) async {
expect(request.url, requestUri);
return Response('', statusCode, reasonPhrase: reason);
return Response('', statusCode, reasonPhrase: reason, request: request);
});
}
}
Expand Down
18 changes: 18 additions & 0 deletions dart/test/scope_test.dart
Expand Up @@ -97,6 +97,20 @@ void main() {
expect(sut.breadcrumbs.length, 0);
});

test('Executes and mutates $Breadcrumb', () {
final sut = fixture.getSut(
beforeBreadcrumbCallback: fixture.beforeBreadcrumbMutateCallback,
);

final breadcrumb = Breadcrumb(
message: 'message',
timestamp: DateTime.utc(2019),
);
sut.addBreadcrumb(breadcrumb);

expect(sut.breadcrumbs.first.message, 'new message');
});

test('adds $EventProcessor', () {
final sut = fixture.getSut();

Expand Down Expand Up @@ -642,6 +656,10 @@ class Fixture {
Breadcrumb? beforeBreadcrumbCallback(Breadcrumb? breadcrumb,
{dynamic hint}) =>
null;

Breadcrumb? beforeBreadcrumbMutateCallback(Breadcrumb? breadcrumb,
{dynamic hint}) =>
breadcrumb?.copyWith(message: 'new message');
}

class AddTagsEventProcessor extends EventProcessor {
Expand Down
2 changes: 1 addition & 1 deletion flutter/example/ios/Runner.xcodeproj/project.pbxproj
Expand Up @@ -160,7 +160,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1330;
LastUpgradeCheck = 1300;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter 3.0.5 always changes that, so better to keep this change.

ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down