11#import " RNSentryTests.h"
2+ #import " RNSentryStart+Test.h"
23#import < OCMock/OCMock.h>
34#import < RNSentry/RNSentry.h>
45#import < Sentry/SentryDebugImageProvider+HybridSDKs.h>
@@ -25,8 +26,8 @@ - (void)testCreateOptionsWithDictionaryRemovesPerformanceProperties
2526, @" enableTracing" : @YES ,
2627}
2728;
28- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
29- error: &error];
29+ SentryOptions *actualOptions =
30+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
3031
3132XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
3233XCTAssertNil (error, @" Should not pass no error" );
@@ -46,8 +47,8 @@ - (void)testCaptureFailedRequestsIsDisabled
4647 NSDictionary *_Nonnull mockedReactNativeDictionary = @{
4748 @" dsn" :
@" https://[email protected] /123456" ,
4849 };
49- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
50- error: &error];
50+ SentryOptions *actualOptions =
51+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
5152
5253 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
5354 XCTAssertNil (error, @" Should not pass no error" );
@@ -62,8 +63,8 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingDefault
6263 NSDictionary *_Nonnull mockedReactNativeDictionary = @{
6364 @" dsn" :
@" https://[email protected] /123456" ,
6465 };
65- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
66- error: &error];
66+ SentryOptions *actualOptions =
67+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
6768 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
6869 XCTAssertNil (error, @" Should not pass no error" );
6970 XCTAssertEqual ([actualOptions.integrations containsObject: @" SentryCrashIntegration" ], true ,
@@ -78,8 +79,8 @@ - (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDefault
7879 NSDictionary *_Nonnull mockedReactNativeDictionary = @{
7980 @" dsn" :
@" https://[email protected] /123456" ,
8081 };
81- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
82- error: &error];
82+ SentryOptions *actualOptions =
83+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
8384 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
8485 XCTAssertNil (error, @" Should not pass no error" );
8586 XCTAssertEqual (
@@ -95,8 +96,8 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingEnabled
9596 @" dsn" :
@" https://[email protected] /123456" ,
9697 @" enableNativeCrashHandling" : @YES ,
9798 };
98- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
99- error: &error];
99+ SentryOptions *actualOptions =
100+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
100101 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
101102 XCTAssertNil (error, @" Should not pass no error" );
102103 XCTAssertEqual ([actualOptions.integrations containsObject: @" SentryCrashIntegration" ], true ,
@@ -112,8 +113,8 @@ - (void)testCreateOptionsWithDictionaryAutoPerformanceTracingEnabled
112113 @" dsn" :
@" https://[email protected] /123456" ,
113114 @" enableAutoPerformanceTracing" : @YES ,
114115 };
115- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
116- error: &error];
116+ SentryOptions *actualOptions =
117+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
117118 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
118119 XCTAssertNil (error, @" Should not pass no error" );
119120 XCTAssertEqual (
@@ -129,8 +130,8 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingDisabled
129130 @" dsn" :
@" https://[email protected] /123456" ,
130131 @" enableNativeCrashHandling" : @NO ,
131132 };
132- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
133- error: &error];
133+ SentryOptions *actualOptions =
134+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
134135 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
135136 XCTAssertNil (error, @" Should not pass no error" );
136137 XCTAssertEqual ([actualOptions.integrations containsObject: @" SentryCrashIntegration" ], false ,
@@ -146,8 +147,8 @@ - (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDisabled
146147 @" dsn" :
@" https://[email protected] /123456" ,
147148 @" enableAutoPerformanceTracing" : @NO ,
148149 };
149- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
150- error: &error];
150+ SentryOptions *actualOptions =
151+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
151152 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
152153 XCTAssertNil (error, @" Should not pass no error" );
153154 XCTAssertEqual (actualOptions.enableAutoPerformanceTracing , false ,
@@ -164,8 +165,8 @@ - (void)testCreateOptionsWithDictionarySpotlightEnabled
164165 @" spotlight" : @YES ,
165166 @" defaultSidecarUrl" : @" http://localhost:8969/teststream" ,
166167 };
167- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
168- error: &error];
168+ SentryOptions *actualOptions =
169+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
169170 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
170171 XCTAssertNil (error, @" Should not pass no error" );
171172 XCTAssertTrue (actualOptions.enableSpotlight , @" Did not enable spotlight" );
@@ -182,8 +183,8 @@ - (void)testCreateOptionsWithDictionarySpotlightOne
182183 @" spotlight" : @1 ,
183184 @" defaultSidecarUrl" : @" http://localhost:8969/teststream" ,
184185 };
185- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
186- error: &error];
186+ SentryOptions *actualOptions =
187+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
187188 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
188189 XCTAssertNil (error, @" Should not pass no error" );
189190 XCTAssertTrue (actualOptions.enableSpotlight , @" Did not enable spotlight" );
@@ -199,8 +200,8 @@ - (void)testCreateOptionsWithDictionarySpotlightUrl
199200 @" dsn" :
@" https://[email protected] /123456" ,
200201 @" spotlight" : @" http://localhost:8969/teststream" ,
201202 };
202- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
203- error: &error];
203+ SentryOptions *actualOptions =
204+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
204205 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
205206 XCTAssertNil (error, @" Should not pass no error" );
206207 XCTAssertTrue (actualOptions.enableSpotlight , @" Did not enable spotlight" );
@@ -216,8 +217,8 @@ - (void)testCreateOptionsWithDictionarySpotlightDisabled
216217 @" dsn" :
@" https://[email protected] /123456" ,
217218 @" spotlight" : @NO ,
218219 };
219- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
220- error: &error];
220+ SentryOptions *actualOptions =
221+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
221222 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
222223 XCTAssertNil (error, @" Should not pass no error" );
223224 XCTAssertFalse (actualOptions.enableSpotlight , @" Did not disable spotlight" );
@@ -232,8 +233,8 @@ - (void)testCreateOptionsWithDictionarySpotlightZero
232233 @" dsn" :
@" https://[email protected] /123456" ,
233234 @" spotlight" : @0 ,
234235 };
235- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
236- error: &error];
236+ SentryOptions *actualOptions =
237+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
237238 XCTAssertNotNil (actualOptions, @" Did not create sentry options" );
238239 XCTAssertNil (error, @" Should not pass no error" );
239240 XCTAssertFalse (actualOptions.enableSpotlight , @" Did not disable spotlight" );
@@ -247,8 +248,8 @@ - (void)testPassesErrorOnWrongDsn
247248 NSDictionary *_Nonnull mockedReactNativeDictionary = @{
248249 @" dsn" : @" not_a_valid_dsn" ,
249250 };
250- SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary: mockedReactNativeDictionary
251- error: &error];
251+ SentryOptions *actualOptions =
252+ [RNSentryStart createOptionsWithDictionary: mockedReactNativeDictionary error: &error];
252253
253254 XCTAssertNil (actualOptions, @" Created invalid sentry options" );
254255 XCTAssertNotNil (error, @" Did not created error on invalid dsn" );
@@ -263,7 +264,8 @@ - (void)testBeforeBreadcrumbsCallbackFiltersOutSentryDsnRequestBreadcrumbs
263264 @" dsn" :
@" https://[email protected] /1234567" ,
264265 @" devServerUrl" : @" http://localhost:8081"
265266 };
266- SentryOptions *options = [rnSentry createOptionsWithDictionary: mockedDictionary error: &error];
267+ SentryOptions *options = [RNSentryStart createOptionsWithDictionary: mockedDictionary
268+ error: &error];
267269
268270 SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc ] init ];
269271 breadcrumb.type = @" http" ;
@@ -283,7 +285,8 @@ - (void)testBeforeBreadcrumbsCallbackFiltersOutDevServerRequestBreadcrumbs
283285
284286 NSDictionary *_Nonnull mockedDictionary =
285287 @{
@" dsn" :
@" https://[email protected] /1234567" ,
@" devServerUrl" : mockDevServer };
286- SentryOptions *options = [rnSentry createOptionsWithDictionary: mockedDictionary error: &error];
288+ SentryOptions *options = [RNSentryStart createOptionsWithDictionary: mockedDictionary
289+ error: &error];
287290
288291 SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc ] init ];
289292 breadcrumb.type = @" http" ;
@@ -303,7 +306,8 @@ - (void)testBeforeBreadcrumbsCallbackDoesNotFiltersOutNonDevServerOrDsnRequestBr
303306 @" dsn" :
@" https://[email protected] /1234567" ,
304307 @" devServerUrl" : @" http://localhost:8081"
305308 };
306- SentryOptions *options = [rnSentry createOptionsWithDictionary: mockedDictionary error: &error];
309+ SentryOptions *options = [RNSentryStart createOptionsWithDictionary: mockedDictionary
310+ error: &error];
307311
308312 SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc ] init ];
309313 breadcrumb.type = @" http" ;
@@ -322,7 +326,8 @@ - (void)testBeforeBreadcrumbsCallbackKeepsBreadcrumbWhenDevServerUrlIsNotPassedA
322326 NSDictionary *_Nonnull mockedDictionary = @{ // dsn is always validated in SentryOptions initialization
323327 @" dsn" :
@" https://[email protected] /1234567" 324328 };
325- SentryOptions *options = [rnSentry createOptionsWithDictionary: mockedDictionary error: &error];
329+ SentryOptions *options = [RNSentryStart createOptionsWithDictionary: mockedDictionary
330+ error: &error];
326331
327332 SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc ] init ];
328333 breadcrumb.type = @" http" ;
@@ -341,7 +346,7 @@ - (void)testEventFromSentryCocoaReactNativeHasOriginAndEnvironmentTags
341346 @" name" : @" sentry.cocoa.react-native" ,
342347 };
343348
344- [rnSentry setEventOriginTag: testEvent];
349+ [RNSentryStart setEventOriginTag: testEvent];
345350
346351 XCTAssertEqual (testEvent.tags [@" event.origin" ], @" ios" );
347352 XCTAssertEqual (testEvent.tags [@" event.environment" ], @" native" );
@@ -359,7 +364,7 @@ - (void)testEventFromSentryReactNativeOriginAndEnvironmentTagsAreOverwritten
359364 @" event.environment" : @" testEventEnvironmentTag" ,
360365 };
361366
362- [rnSentry setEventOriginTag: testEvent];
367+ [RNSentryStart setEventOriginTag: testEvent];
363368
364369 XCTAssertEqual (testEvent.tags [@" event.origin" ], @" ios" );
365370 XCTAssertEqual (testEvent.tags [@" event.environment" ], @" native" );
0 commit comments