-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ios): Don't pass enableTracing from RN to sentry-cocoa options (#…
- Loading branch information
1 parent
5d0d7b3
commit 27d9ece
Showing
3 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -18,8 +18,11 @@ - (void)testCreateOptionsWithDictionaryRemovesPerformanceProperties | |
NSDictionary *_Nonnull mockedReactNativeDictionary = @{ | ||
@"dsn": @"https://[email protected]/123456", | ||
@"beforeSend": @"will_be_overwritten", | ||
@"enableNativeCrashHandling": @YES, | ||
|
||
@"tracesSampleRate": @1, | ||
@"tracesSampler": ^(SentrySamplingContext *_Nonnull samplingContext) { | ||
return @1; | ||
}, | ||
@"enableTracing": @YES, | ||
}; | ||
SentryOptions* actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; | ||
|
||
|
@@ -28,6 +31,7 @@ - (void)testCreateOptionsWithDictionaryRemovesPerformanceProperties | |
XCTAssertNotNil(actualOptions.beforeSend, @"Before send is overwriten by the native RNSentry implementation"); | ||
XCTAssertEqual(actualOptions.tracesSampleRate, nil, @"Traces sample rate should not be passed to native"); | ||
XCTAssertEqual(actualOptions.tracesSampler, nil, @"Traces sampler should not be passed to native"); | ||
XCTAssertEqual(actualOptions.enableTracing, false, @"EnableTracing should not be passed to native"); | ||
} | ||
|
||
- (void)testCreateOptionsWithDictionaryNativeCrashHandlingDefault | ||
|
@@ -44,7 +48,7 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingDefault | |
XCTAssertEqual([actualOptions.integrations containsObject:@"SentryCrashIntegration"], true, @"Did not set native crash handling"); | ||
} | ||
|
||
- (void)testCreateOptionsWithDictionaryPerformanceTrackingDefault | ||
- (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDefault | ||
{ | ||
RNSentry * rnSentry = [[RNSentry alloc] init]; | ||
NSError* error = nil; | ||
|
@@ -73,15 +77,14 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingEnabled | |
XCTAssertEqual([actualOptions.integrations containsObject:@"SentryCrashIntegration"], true, @"Did not set native crash handling"); | ||
} | ||
|
||
- (void)testCreateOptionsWithDictionaryPerformanceTrackingEnabled | ||
- (void)testCreateOptionsWithDictionaryAutoPerformanceTracingEnabled | ||
{ | ||
RNSentry * rnSentry = [[RNSentry alloc] init]; | ||
NSError* error = nil; | ||
|
||
NSDictionary *_Nonnull mockedReactNativeDictionary = @{ | ||
@"dsn": @"https://[email protected]/123456", | ||
@"enableAutoPerformanceTracing": @YES, | ||
|
||
}; | ||
SentryOptions* actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; | ||
XCTAssertNotNil(actualOptions, @"Did not create sentry options"); | ||
|
@@ -97,23 +100,21 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingDisabled | |
NSDictionary *_Nonnull mockedReactNativeDictionary = @{ | ||
@"dsn": @"https://[email protected]/123456", | ||
@"enableNativeCrashHandling": @NO, | ||
|
||
}; | ||
SentryOptions* actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; | ||
XCTAssertNotNil(actualOptions, @"Did not create sentry options"); | ||
XCTAssertNil(error, @"Should not pass no error"); | ||
XCTAssertEqual([actualOptions.integrations containsObject:@"SentryCrashIntegration"], false, @"Did not disable native crash handling"); | ||
} | ||
|
||
- (void)testCreateOptionsWithDictionaryPerformanceTrackingDisabled | ||
- (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDisabled | ||
{ | ||
RNSentry * rnSentry = [[RNSentry alloc] init]; | ||
NSError* error = nil; | ||
|
||
NSDictionary *_Nonnull mockedReactNativeDictionary = @{ | ||
@"dsn": @"https://[email protected]/123456", | ||
@"enableAutoPerformanceTracing": @NO, | ||
|
||
}; | ||
SentryOptions* actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; | ||
XCTAssertNotNil(actualOptions, @"Did not create sentry options"); | ||
|
@@ -127,7 +128,7 @@ - (void)testPassesErrorOnWrongDsn | |
NSError* error = nil; | ||
|
||
NSDictionary *_Nonnull mockedReactNativeDictionary = @{ | ||
@"dsn": @"not_a_valid_dsn" | ||
@"dsn": @"not_a_valid_dsn", | ||
}; | ||
SentryOptions* actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; | ||
|
||
|
@@ -140,7 +141,7 @@ - (void)testEventFromSentryCocoaReactNativeHasOriginAndEnvironmentTags | |
RNSentry* rnSentry = [[RNSentry alloc] init]; | ||
SentryEvent* testEvent = [[SentryEvent alloc] init]; | ||
testEvent.sdk = @{ | ||
@"name": @"sentry.cocoa.react-native" | ||
@"name": @"sentry.cocoa.react-native", | ||
}; | ||
|
||
[rnSentry setEventOriginTag: testEvent]; | ||
|
@@ -154,11 +155,11 @@ - (void)testEventFromSentryReactNativeOriginAndEnvironmentTagsAreOverwritten | |
RNSentry* rnSentry = [[RNSentry alloc] init]; | ||
SentryEvent* testEvent = [[SentryEvent alloc] init]; | ||
testEvent.sdk = @{ | ||
@"name": @"sentry.cocoa.react-native" | ||
@"name": @"sentry.cocoa.react-native", | ||
}; | ||
testEvent.tags = @{ | ||
@"event.origin": @"testEventOriginTag", | ||
@"event.environment": @"testEventEnvironmentTag" | ||
@"event.environment": @"testEventEnvironmentTag", | ||
}; | ||
|
||
[rnSentry setEventOriginTag: testEvent]; | ||
|
This file contains 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