-
-
Notifications
You must be signed in to change notification settings - Fork 368
feat(core): Expose native network breadcrumb options #6764
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โll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3aff7f3
feat(core): Expose native network breadcrumb options
antonis b6fb6c1
docs: Point CHANGELOG entry at PR #6764
antonis a5380b0
test(android): Add unit tests for enableNetworkEventBreadcrumbs mapping
antonis 2cade1b
docs(core): Correct enableNetworkEventBreadcrumbs description
antonis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/core/android/src/test/java/io/sentry/react/RNSentryStartTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package io.sentry.react; | ||
|
|
||
| import static org.junit.Assert.assertFalse; | ||
| import static org.junit.Assert.assertTrue; | ||
| import static org.mockito.Mockito.mock; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| import com.facebook.react.bridge.ReadableMap; | ||
| import io.sentry.ILogger; | ||
| import io.sentry.android.core.SentryAndroidOptions; | ||
| import org.junit.Test; | ||
|
|
||
| /** | ||
| * Coverage for the native option mapping in {@link RNSentryStart#getSentryAndroidOptions} โ that RN | ||
| * options forwarded from JS are applied onto {@link SentryAndroidOptions}. | ||
| */ | ||
| public class RNSentryStartTest { | ||
|
|
||
| private static SentryAndroidOptions optionsFrom(ReadableMap rnOptions) { | ||
| final SentryAndroidOptions options = new SentryAndroidOptions(); | ||
| RNSentryStart.getSentryAndroidOptions(options, rnOptions, mock(ILogger.class)); | ||
| return options; | ||
| } | ||
|
|
||
| @Test | ||
| public void enableNetworkEventBreadcrumbsForwardsTrue() { | ||
| final ReadableMap rnOptions = mock(ReadableMap.class); | ||
| when(rnOptions.hasKey("enableNetworkEventBreadcrumbs")).thenReturn(true); | ||
| when(rnOptions.getBoolean("enableNetworkEventBreadcrumbs")).thenReturn(true); | ||
|
|
||
| assertTrue(optionsFrom(rnOptions).isEnableNetworkEventBreadcrumbs()); | ||
| } | ||
|
|
||
| @Test | ||
| public void enableNetworkEventBreadcrumbsForwardsFalse() { | ||
| final ReadableMap rnOptions = mock(ReadableMap.class); | ||
| when(rnOptions.hasKey("enableNetworkEventBreadcrumbs")).thenReturn(true); | ||
| when(rnOptions.getBoolean("enableNetworkEventBreadcrumbs")).thenReturn(false); | ||
|
|
||
| assertFalse(optionsFrom(rnOptions).isEnableNetworkEventBreadcrumbs()); | ||
| } | ||
|
|
||
| @Test | ||
| public void enableNetworkEventBreadcrumbsPreservesNativeDefaultWhenUnset() { | ||
| final ReadableMap rnOptions = mock(ReadableMap.class); | ||
|
|
||
| // Native default is true; omitting the RN option must not change it. | ||
| assertTrue(optionsFrom(rnOptions).isEnableNetworkEventBreadcrumbs()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.