@bugsee/react-native 0.0.0-stage → 7.0.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BugseeReactNative.podspec +95 -0
- package/LICENSE +21 -0
- package/README.md +557 -2
- package/android/build.gradle +162 -0
- package/android/consumer-rules.pro +2 -0
- package/android/src/main/AndroidManifest.xml +33 -0
- package/android/src/main/java/com/bugsee/reactnative/AppearanceBridge.java +82 -0
- package/android/src/main/java/com/bugsee/reactnative/AttributeBridge.java +209 -0
- package/android/src/main/java/com/bugsee/reactnative/BreadcrumbFilterBridge.java +443 -0
- package/android/src/main/java/com/bugsee/reactnative/BridgeJson.java +168 -0
- package/android/src/main/java/com/bugsee/reactnative/BugseeModule.java +1869 -0
- package/android/src/main/java/com/bugsee/reactnative/BugseeOptionEnums.java +136 -0
- package/android/src/main/java/com/bugsee/reactnative/BugseePackage.java +42 -0
- package/android/src/main/java/com/bugsee/reactnative/BugseeReactNativeWrapper.java +200 -0
- package/android/src/main/java/com/bugsee/reactnative/BugseeStatusMapper.java +66 -0
- package/android/src/main/java/com/bugsee/reactnative/BugseeTokens.java +22 -0
- package/android/src/main/java/com/bugsee/reactnative/ConsoleEchoDedup.java +202 -0
- package/android/src/main/java/com/bugsee/reactnative/CreatedReports.java +127 -0
- package/android/src/main/java/com/bugsee/reactnative/DataRequestBridge.java +375 -0
- package/android/src/main/java/com/bugsee/reactnative/ExceptionBridge.java +88 -0
- package/android/src/main/java/com/bugsee/reactnative/ExceptionExecutors.java +33 -0
- package/android/src/main/java/com/bugsee/reactnative/LogFilterBridge.java +375 -0
- package/android/src/main/java/com/bugsee/reactnative/NetworkEvents.java +227 -0
- package/android/src/main/java/com/bugsee/reactnative/NetworkFilterBridge.java +498 -0
- package/android/src/main/java/com/bugsee/reactnative/PluginEndpoint.java +48 -0
- package/android/src/main/java/com/bugsee/reactnative/ReactNativeWebException.java +19 -0
- package/android/src/main/java/com/bugsee/reactnative/ReactNativeWrapperInitProvider.java +61 -0
- package/android/src/main/java/com/bugsee/reactnative/ReactRootOriginTracker.java +867 -0
- package/android/src/main/java/com/bugsee/reactnative/ReportArgs.java +58 -0
- package/android/src/main/java/com/bugsee/reactnative/ReportHandlerBridge.java +336 -0
- package/android/src/main/java/com/bugsee/reactnative/ReportHandlerDeadlines.java +57 -0
- package/android/src/main/java/com/bugsee/reactnative/ReportOps.java +287 -0
- package/android/src/main/java/com/bugsee/reactnative/SecureRectanglePulls.java +113 -0
- package/android/src/main/java/com/bugsee/reactnative/SecureRectangleStore.java +692 -0
- package/android/src/main/java/com/bugsee/reactnative/SpanHandles.java +143 -0
- package/android/src/main/java/com/bugsee/reactnative/WrapperChannelHolder.java +137 -0
- package/android/src/main/java/com/bugsee/reactnative/WrapperEventBus.java +110 -0
- package/android/src/main/java/com/bugsee/reactnative/WrapperRegistrar.java +54 -0
- package/app.plugin.js +4 -0
- package/ios/BGSRNConsoleCapture.h +52 -0
- package/ios/BGSRNConsoleCapture.mm +344 -0
- package/ios/BugseeModule.h +25 -0
- package/ios/BugseeModule.mm +2728 -0
- package/ios/Package.swift +71 -0
- package/ios/Support/Package.resolved +14 -0
- package/ios/Support/Package.swift +44 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNAttributes.m +52 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNCreatedReportOps.m +236 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNCreatedReports.m +184 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNDataRequestBridge.m +431 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNErrorMessage.m +40 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNEventBus.m +70 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNExceptions.m +63 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNGuardedEmit.mm +32 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNJSON.m +40 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNLaunchHold.m +147 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNMainThread.m +23 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNNetworkEvents.m +159 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNNetworkFilter.m +155 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNPluginEndpoint.m +21 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNReactRootOriginTracker.m +63 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNReactWindow.m +251 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNReportArgs.m +47 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNReportDeadlines.m +8 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNReportHandlerBridge.m +308 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNReportOps.m +345 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNSecureRectangles.m +508 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNSettleOnce.m +62 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNSpanHandles.m +136 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNStatusMapper.m +18 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNTokens.m +9 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNValues.m +5 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNWrapper.m +54 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNWrapperChannelHolder.m +59 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNAttributes.h +63 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNCreatedReportOps.h +51 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNCreatedReports.h +81 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNDataRequestBridge.h +118 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNErrorMessage.h +30 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNEventBus.h +45 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNExceptions.h +31 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNGuardedEmit.h +31 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNJSON.h +25 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNLaunchHold.h +86 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNMainThread.h +32 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNNetworkEvents.h +28 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNNetworkFilter.h +28 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNPluginEndpoint.h +17 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReactRootOriginTracker.h +48 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReactWindow.h +135 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportArgs.h +17 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportDeadlines.h +37 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportHandlerBridge.h +94 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportOps.h +86 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNSecureRectangles.h +198 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNSettleOnce.h +25 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNSpanHandles.h +49 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNStatusMapper.h +26 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNTokens.h +14 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNValues.h +18 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNWrapper.h +40 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNWrapperChannelHolder.h +74 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNAttributesTests.m +194 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNCreatedReportOpsTests.m +274 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNCreatedReportsTests.m +240 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNDataRequestBridgeTests.m +685 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNErrorMessageTests.m +102 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNEventBusTests.m +136 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNExceptionsTests.m +68 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFakeReport.h +41 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFakeReport.m +166 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNGuardedEmitTests.mm +85 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNJSONTests.m +281 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNLaunchHoldTests.m +230 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNMainThreadTests.m +97 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNNetworkEventsTests.m +99 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNNetworkFilterTests.m +134 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNPluginEndpointTests.m +38 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReactRootOriginTrackerTests.m +210 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReactWindowTests.m +548 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReportArgsTests.m +51 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReportDeadlinesTests.m +22 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReportHandlerBridgeTests.m +382 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReportOpsTests.m +295 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNSecureRectanglesTests.m +568 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNSettleOnceTests.m +134 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNSpanHandlesTests.m +153 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNStatusMapperTests.m +81 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNValuesTests.m +32 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNWrapperChannelHolderTests.m +205 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNWrapperTests.m +66 -0
- package/ios/react-native-spm-prefix.h +10 -0
- package/native-versions.json +10 -0
- package/package.json +62 -3
- package/plugin/build/bundle-phase.d.ts +41 -0
- package/plugin/build/bundle-phase.js +116 -0
- package/plugin/build/bundle-phase.js.map +1 -0
- package/plugin/build/dsym-script.d.ts +32 -0
- package/plugin/build/dsym-script.js +159 -0
- package/plugin/build/dsym-script.js.map +1 -0
- package/plugin/build/endpoint.d.ts +30 -0
- package/plugin/build/endpoint.js +69 -0
- package/plugin/build/endpoint.js.map +1 -0
- package/plugin/build/gradle.d.ts +65 -0
- package/plugin/build/gradle.js +1066 -0
- package/plugin/build/gradle.js.map +1 -0
- package/plugin/build/index.d.ts +85 -0
- package/plugin/build/index.js +217 -0
- package/plugin/build/index.js.map +1 -0
- package/plugin/build/manifest.d.ts +48 -0
- package/plugin/build/manifest.js +69 -0
- package/plugin/build/manifest.js.map +1 -0
- package/plugin/build/native-versions.baked.json +4 -0
- package/plugin/build/native-versions.d.ts +10 -0
- package/plugin/build/native-versions.js +27 -0
- package/plugin/build/native-versions.js.map +1 -0
- package/plugin/build/pbx-string.d.ts +8 -0
- package/plugin/build/pbx-string.js +31 -0
- package/plugin/build/pbx-string.js.map +1 -0
- package/plugin/build/podfile.d.ts +3 -0
- package/plugin/build/podfile.js +28 -0
- package/plugin/build/podfile.js.map +1 -0
- package/plugin/build/properties.d.ts +19 -0
- package/plugin/build/properties.js +41 -0
- package/plugin/build/properties.js.map +1 -0
- package/plugin/build/scheme.d.ts +20 -0
- package/plugin/build/scheme.js +107 -0
- package/plugin/build/scheme.js.map +1 -0
- package/react-native.config.js +26 -0
- package/scripts/bugsee-sourcemaps.gradle +201 -0
- package/scripts/bugsee-xcode.sh +83 -0
- package/scripts/compose-then-inject.js +113 -0
- package/scripts/hermes-sourcemaps.js +634 -0
- package/scripts/hermesc-preserve-js.cmd +6 -0
- package/scripts/hermesc-preserve-js.js +200 -0
- package/scripts/hermesc-preserve-js.sh +7 -0
- package/src/NativeBugsee.ts +622 -0
- package/src/apm/notify.ts +58 -0
- package/src/apm/span.ts +403 -0
- package/src/apm/types.ts +57 -0
- package/src/appearance/report.ts +171 -0
- package/src/architecture.ts +48 -0
- package/src/attributes/errors.ts +39 -0
- package/src/attributes/validate.ts +150 -0
- package/src/breadcrumbs/add.ts +58 -0
- package/src/breadcrumbs/data.ts +33 -0
- package/src/breadcrumbs/filter.ts +215 -0
- package/src/breadcrumbs/types.ts +64 -0
- package/src/bridge/json.ts +110 -0
- package/src/console/capture.ts +180 -0
- package/src/console/dedup.ts +175 -0
- package/src/data/validate.ts +259 -0
- package/src/errorName.ts +32 -0
- package/src/exceptions/ErrorBoundary.tsx +92 -0
- package/src/exceptions/RootErrorReporter.tsx +61 -0
- package/src/exceptions/debugIds.ts +118 -0
- package/src/exceptions/handlers.ts +236 -0
- package/src/exceptions/options.ts +85 -0
- package/src/exceptions/payload.ts +456 -0
- package/src/exceptions/report.ts +170 -0
- package/src/exceptions/sha1.ts +148 -0
- package/src/exceptions/stack.ts +355 -0
- package/src/index.ts +962 -0
- package/src/logs/filter.ts +90 -0
- package/src/logs/log.ts +36 -0
- package/src/network/add.ts +165 -0
- package/src/network/filter.ts +198 -0
- package/src/options/AndroidLaunchOptions.ts +78 -0
- package/src/options/BugseeLaunchOptions.ts +190 -0
- package/src/options/IOSLaunchOptions.ts +57 -0
- package/src/options/android-options-manifest.json +646 -0
- package/src/options/createDefaultLaunchOptions.ts +29 -0
- package/src/options/endpoint.ts +58 -0
- package/src/options/enums.ts +104 -0
- package/src/options/ios-enums.json +19 -0
- package/src/options/keys.ts +39 -0
- package/src/options/option-enums.json +34 -0
- package/src/options/option-keys.json +107 -0
- package/src/report/BugseeReport.ts +264 -0
- package/src/report/CreatedReport.ts +127 -0
- package/src/report/dispatcher.ts +95 -0
- package/src/report/errors.ts +48 -0
- package/src/report/fields.ts +40 -0
- package/src/report/types.ts +157 -0
- package/src/report/validate.ts +197 -0
- package/src/secure/BugseeSecure.tsx +202 -0
- package/src/secure/ancestry.ts +622 -0
- package/src/secure/drivers.ts +342 -0
- package/src/secure/followEvents.ts +57 -0
- package/src/secure/hold.ts +99 -0
- package/src/secure/measureLoop.ts +323 -0
- package/src/secure/nativeAnimation.ts +1005 -0
- package/src/secure/rectangles.ts +93 -0
- package/src/secure/registry.ts +237 -0
- package/src/secure/surface.ts +83 -0
- package/src/secure/tracker.ts +723 -0
- package/src/secure/transition.ts +488 -0
- package/src/secure/unit.ts +22 -0
- package/src/status.ts +16 -0
- package/src/version.ts +9 -0
- package/src/viewtree/anchor.tsx +105 -0
- package/src/viewtree/constants.ts +20 -0
- package/src/viewtree/fiber.ts +251 -0
- package/src/viewtree/requests.ts +347 -0
- package/src/viewtree/walk.ts +902 -0
- package/src/wrapper/channel.ts +33 -0
- package/src/wrapper/collect.ts +52 -0
- package/src/wrapper/events.ts +45 -0
- package/src/wrapper/identity.ts +54 -0
- package/src/wrapper/lifecycle-events.ts +89 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@import XCTest;
|
|
2
|
+
@import Bugsee;
|
|
3
|
+
@import BugseeRNSupport;
|
|
4
|
+
|
|
5
|
+
@interface BGSRNNetworkEventsTests : XCTestCase
|
|
6
|
+
@end
|
|
7
|
+
|
|
8
|
+
@implementation BGSRNNetworkEventsTests
|
|
9
|
+
|
|
10
|
+
- (void)testCompletedRequiresFilteringAndStampsTheClock {
|
|
11
|
+
__block BugseeNetworkEvent *submitted = nil;
|
|
12
|
+
__block BOOL filtering = NO;
|
|
13
|
+
__block NSInteger submits = 0;
|
|
14
|
+
|
|
15
|
+
BGSRNNetworkEventOutcome outcome = BGSRNRecordNetworkEvent(
|
|
16
|
+
@{@"url" : @"https://e2e.example/keep", @"method" : @"GET", @"stage" : @"completed"},
|
|
17
|
+
^(BugseeNetworkEvent *event, BOOL requiresFiltering) {
|
|
18
|
+
submits += 1;
|
|
19
|
+
submitted = event;
|
|
20
|
+
filtering = requiresFiltering;
|
|
21
|
+
},
|
|
22
|
+
1700000000000.0);
|
|
23
|
+
|
|
24
|
+
XCTAssertEqual(outcome, BGSRNNetworkEventOutcomeAdded);
|
|
25
|
+
XCTAssertEqual(submits, 1);
|
|
26
|
+
XCTAssertTrue(filtering);
|
|
27
|
+
XCTAssertEqual(submitted.type, BugseeNetwork);
|
|
28
|
+
XCTAssertEqualObjects(submitted.bugseeNetworkEventType, BugseeNetworkEventComplete);
|
|
29
|
+
XCTAssertEqualObjects(submitted.mechanism, @"react-native");
|
|
30
|
+
XCTAssertEqualObjects(submitted.method, @"GET");
|
|
31
|
+
XCTAssertEqualObjects(submitted.url, @"https://e2e.example/keep");
|
|
32
|
+
XCTAssertEqual(submitted.timestamp, 1700000000000.0);
|
|
33
|
+
XCTAssertGreaterThan(submitted.ID.length, 0u);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (void)testAnUnknownStageIsNotSubmitted {
|
|
37
|
+
__block NSInteger submits = 0;
|
|
38
|
+
BGSRNNetworkEventOutcome outcome = BGSRNRecordNetworkEvent(
|
|
39
|
+
@{@"url" : @"https://e2e.example/keep", @"method" : @"GET", @"stage" : @"done"},
|
|
40
|
+
^(BugseeNetworkEvent *event, BOOL requiresFiltering) {
|
|
41
|
+
submits += 1;
|
|
42
|
+
},
|
|
43
|
+
0);
|
|
44
|
+
XCTAssertEqual(outcome, BGSRNNetworkEventOutcomeRejected);
|
|
45
|
+
XCTAssertEqual(submits, 0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (void)testWritableFilterFieldsAreSet {
|
|
49
|
+
__block BugseeNetworkEvent *submitted = nil;
|
|
50
|
+
BGSRNNetworkEventOutcome outcome = BGSRNRecordNetworkEvent(
|
|
51
|
+
@{
|
|
52
|
+
@"url" : @"https://e2e.example/keep",
|
|
53
|
+
@"method" : @"POST",
|
|
54
|
+
@"stage" : @"error",
|
|
55
|
+
@"id" : @"evt-1",
|
|
56
|
+
@"body" : @"secret",
|
|
57
|
+
@"headers" : @{@"Authorization" : @"Bearer x"},
|
|
58
|
+
@"responseCode" : @201,
|
|
59
|
+
@"redirectedFromURL" : @"https://e2e.example/from",
|
|
60
|
+
@"error" : @{@"domain" : @"test"},
|
|
61
|
+
},
|
|
62
|
+
^(BugseeNetworkEvent *event, BOOL requiresFiltering) {
|
|
63
|
+
XCTAssertTrue(requiresFiltering);
|
|
64
|
+
submitted = event;
|
|
65
|
+
},
|
|
66
|
+
5);
|
|
67
|
+
XCTAssertEqual(outcome, BGSRNNetworkEventOutcomeAdded);
|
|
68
|
+
XCTAssertEqual(submitted.type, BugseeNetwork);
|
|
69
|
+
XCTAssertEqualObjects(submitted.bugseeNetworkEventType, BugseeNetworkEventError);
|
|
70
|
+
XCTAssertEqualObjects(submitted.ID, @"evt-1");
|
|
71
|
+
XCTAssertEqualObjects(submitted.method, @"POST");
|
|
72
|
+
NSString *body = [[NSString alloc] initWithData:submitted.body encoding:NSUTF8StringEncoding];
|
|
73
|
+
XCTAssertEqualObjects(body, @"secret");
|
|
74
|
+
XCTAssertEqualObjects(submitted.headers[@"Authorization"], @"Bearer x");
|
|
75
|
+
XCTAssertEqual(submitted.responseCode, 201);
|
|
76
|
+
XCTAssertEqualObjects(submitted.redirectedFromURL, @"https://e2e.example/from");
|
|
77
|
+
XCTAssertEqualObjects(submitted.error[@"domain"], @"test");
|
|
78
|
+
XCTAssertEqualObjects(submitted.mechanism, @"react-native");
|
|
79
|
+
XCTAssertEqual(submitted.timestamp, 5);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
- (void)testBeginAndCancelUseThoseConstants {
|
|
83
|
+
__block NSString *begin = nil;
|
|
84
|
+
__block NSString *cancel = nil;
|
|
85
|
+
BGSRNRecordNetworkEvent(@{@"url" : @"https://e2e.example/keep", @"method" : @"GET", @"stage" : @"before"},
|
|
86
|
+
^(BugseeNetworkEvent *event, BOOL requiresFiltering) {
|
|
87
|
+
begin = event.bugseeNetworkEventType;
|
|
88
|
+
},
|
|
89
|
+
1);
|
|
90
|
+
BGSRNRecordNetworkEvent(@{@"url" : @"https://e2e.example/keep", @"method" : @"GET", @"stage" : @"abort"},
|
|
91
|
+
^(BugseeNetworkEvent *event, BOOL requiresFiltering) {
|
|
92
|
+
cancel = event.bugseeNetworkEventType;
|
|
93
|
+
},
|
|
94
|
+
1);
|
|
95
|
+
XCTAssertEqualObjects(begin, BugseeNetworkEventBegin);
|
|
96
|
+
XCTAssertEqualObjects(cancel, BugseeNetworkEventCancel);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@end
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@import XCTest;
|
|
2
|
+
@import Bugsee;
|
|
3
|
+
@import BugseeRNSupport;
|
|
4
|
+
|
|
5
|
+
/// A non-UTF-8 body must survive the filter's identity and spread replies.
|
|
6
|
+
/// The snapshot omits `body` for those bytes; apply leaves a missing key
|
|
7
|
+
/// alone. JSON null is reserved for a body that is actually nil or empty,
|
|
8
|
+
/// and that null still clears.
|
|
9
|
+
@interface BGSRNNetworkFilterTests : XCTestCase
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
@implementation BGSRNNetworkFilterTests
|
|
13
|
+
|
|
14
|
+
- (BugseeNetworkEvent *)eventWithBody:(NSData *)body {
|
|
15
|
+
return [BugseeNetworkEvent eventWithID:@"req-1"
|
|
16
|
+
HTTPmethod:@"GET"
|
|
17
|
+
type:BugseeWebSocket
|
|
18
|
+
bugseeEventType:@"message"
|
|
19
|
+
url:@"wss://example/hot"
|
|
20
|
+
redirectedUrl:nil
|
|
21
|
+
body:body
|
|
22
|
+
error:nil
|
|
23
|
+
headers:@{@"Content-Type" : @"application/octet-stream"}
|
|
24
|
+
noBodyReason:nil
|
|
25
|
+
dataSize:(int64_t)body.length
|
|
26
|
+
responseCode:0];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
- (NSDictionary *)payloadOf:(BugseeNetworkEvent *)event {
|
|
30
|
+
NSString *json = BGSRNNetworkEventJSON(event);
|
|
31
|
+
XCTAssertNotNil(json);
|
|
32
|
+
NSData *data = [json dataUsingEncoding:NSUTF8StringEncoding];
|
|
33
|
+
id parsed = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
34
|
+
XCTAssertTrue([parsed isKindOfClass:[NSDictionary class]]);
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)testANonUTF8BodySurvivesAnIdentityOrSpreadReply {
|
|
39
|
+
const uint8_t jpeg[] = {0xFF, 0xD8, 0xFF, 0x00};
|
|
40
|
+
NSData *body = [NSData dataWithBytes:jpeg length:sizeof(jpeg)];
|
|
41
|
+
BugseeNetworkEvent *event = [self eventWithBody:body];
|
|
42
|
+
|
|
43
|
+
NSDictionary *snapshot = [self payloadOf:event];
|
|
44
|
+
XCTAssertFalse([snapshot.allKeys containsObject:@"body"]);
|
|
45
|
+
|
|
46
|
+
NSString *identity = BGSRNNetworkEventJSON(event);
|
|
47
|
+
XCTAssertTrue(BGSRNApplyNetworkReplacement(event, identity));
|
|
48
|
+
XCTAssertEqualObjects(event.body, body);
|
|
49
|
+
|
|
50
|
+
NSMutableDictionary *spread = [snapshot mutableCopy];
|
|
51
|
+
spread[@"url"] = @"wss://example/hot?bugsee-e2e-redacted=1";
|
|
52
|
+
NSData *replyData = [NSJSONSerialization dataWithJSONObject:spread options:0 error:nil];
|
|
53
|
+
NSString *reply = [[NSString alloc] initWithData:replyData encoding:NSUTF8StringEncoding];
|
|
54
|
+
XCTAssertFalse([reply containsString:@"\"body\""]);
|
|
55
|
+
XCTAssertTrue(BGSRNApplyNetworkReplacement(event, reply));
|
|
56
|
+
XCTAssertEqualObjects(event.body, body);
|
|
57
|
+
XCTAssertEqualObjects(event.url, spread[@"url"]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (void)testANilOrEmptyBodyIsJsonNullAndNullClears {
|
|
61
|
+
BugseeNetworkEvent *empty = [self eventWithBody:[NSData data]];
|
|
62
|
+
XCTAssertEqualObjects([self payloadOf:empty][@"body"], NSNull.null);
|
|
63
|
+
|
|
64
|
+
BugseeNetworkEvent *missing = [self eventWithBody:nil];
|
|
65
|
+
XCTAssertEqualObjects([self payloadOf:missing][@"body"], NSNull.null);
|
|
66
|
+
|
|
67
|
+
const uint8_t jpeg[] = {0xFF, 0xD8, 0xFF, 0x00};
|
|
68
|
+
NSData *body = [NSData dataWithBytes:jpeg length:sizeof(jpeg)];
|
|
69
|
+
BugseeNetworkEvent *event = [self eventWithBody:body];
|
|
70
|
+
XCTAssertTrue(BGSRNApplyNetworkReplacement(event, @"{\"body\":null}"));
|
|
71
|
+
XCTAssertNil(event.body);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (void)testAUtf8BodyIsSent {
|
|
75
|
+
NSData *body = [@"hello" dataUsingEncoding:NSUTF8StringEncoding];
|
|
76
|
+
NSDictionary *snapshot = [self payloadOf:[self eventWithBody:body]];
|
|
77
|
+
XCTAssertEqualObjects(snapshot[@"body"], @"hello");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (void)testRedirectedFromURLAndErrorRoundTripAnIdentityOrSpreadReply {
|
|
81
|
+
NSDictionary *nilFields = [self payloadOf:[self eventWithBody:nil]];
|
|
82
|
+
XCTAssertEqualObjects(nilFields[@"redirectedFromURL"], NSNull.null);
|
|
83
|
+
XCTAssertEqualObjects(nilFields[@"error"], NSNull.null);
|
|
84
|
+
|
|
85
|
+
NSDictionary *error = @{@"domain" : @"NSURLErrorDomain", @"code" : @(-1009)};
|
|
86
|
+
BugseeNetworkEvent *event =
|
|
87
|
+
[BugseeNetworkEvent eventWithID:@"req-1"
|
|
88
|
+
HTTPmethod:@"GET"
|
|
89
|
+
type:BugseeNetwork
|
|
90
|
+
bugseeEventType:@"complete"
|
|
91
|
+
url:@"https://example/items"
|
|
92
|
+
redirectedUrl:@"https://example/old"
|
|
93
|
+
body:[@"hello" dataUsingEncoding:NSUTF8StringEncoding]
|
|
94
|
+
error:error
|
|
95
|
+
headers:@{@"Accept" : @"application/json"}
|
|
96
|
+
noBodyReason:nil
|
|
97
|
+
dataSize:5
|
|
98
|
+
responseCode:200];
|
|
99
|
+
NSDictionary *snapshot = [self payloadOf:event];
|
|
100
|
+
XCTAssertEqualObjects(snapshot[@"redirectedFromURL"], @"https://example/old");
|
|
101
|
+
XCTAssertEqualObjects(snapshot[@"error"][@"domain"], @"NSURLErrorDomain");
|
|
102
|
+
XCTAssertEqualObjects(snapshot[@"error"][@"code"], @(-1009));
|
|
103
|
+
|
|
104
|
+
NSString *identity = BGSRNNetworkEventJSON(event);
|
|
105
|
+
XCTAssertTrue(BGSRNApplyNetworkReplacement(event, identity));
|
|
106
|
+
XCTAssertEqualObjects(event.redirectedFromURL, @"https://example/old");
|
|
107
|
+
XCTAssertEqualObjects(event.error[@"domain"], @"NSURLErrorDomain");
|
|
108
|
+
XCTAssertEqualObjects(event.error[@"code"], @(-1009));
|
|
109
|
+
|
|
110
|
+
NSMutableDictionary *spread = [snapshot mutableCopy];
|
|
111
|
+
spread[@"url"] = @"https://example/items?bugsee-e2e-redacted=1";
|
|
112
|
+
NSData *replyData = [NSJSONSerialization dataWithJSONObject:spread options:0 error:nil];
|
|
113
|
+
NSString *reply = [[NSString alloc] initWithData:replyData encoding:NSUTF8StringEncoding];
|
|
114
|
+
XCTAssertTrue([reply containsString:@"\"redirectedFromURL\""]);
|
|
115
|
+
XCTAssertTrue([reply containsString:@"\"error\""]);
|
|
116
|
+
XCTAssertTrue(BGSRNApplyNetworkReplacement(event, reply));
|
|
117
|
+
XCTAssertEqualObjects(event.url, spread[@"url"]);
|
|
118
|
+
XCTAssertEqualObjects(event.redirectedFromURL, @"https://example/old");
|
|
119
|
+
XCTAssertEqualObjects(event.error[@"domain"], @"NSURLErrorDomain");
|
|
120
|
+
XCTAssertEqualObjects(event.error[@"code"], @(-1009));
|
|
121
|
+
|
|
122
|
+
XCTAssertTrue(BGSRNApplyNetworkReplacement(event, @"{\"redirectedFromURL\":null,\"error\":null}"));
|
|
123
|
+
XCTAssertNil(event.redirectedFromURL);
|
|
124
|
+
XCTAssertNil(event.error);
|
|
125
|
+
|
|
126
|
+
event.redirectedFromURL = @"https://example/old";
|
|
127
|
+
event.error = error;
|
|
128
|
+
XCTAssertFalse(BGSRNApplyNetworkReplacement(event, @"{\"redirectedFromURL\":1}"));
|
|
129
|
+
XCTAssertEqualObjects(event.redirectedFromURL, @"https://example/old");
|
|
130
|
+
XCTAssertFalse(BGSRNApplyNetworkReplacement(event, @"{\"error\":\"nope\"}"));
|
|
131
|
+
XCTAssertEqualObjects(event.error[@"domain"], @"NSURLErrorDomain");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@import XCTest;
|
|
2
|
+
|
|
3
|
+
@import BugseeRNSupport;
|
|
4
|
+
|
|
5
|
+
@interface BGSRNPluginEndpointTests : XCTestCase
|
|
6
|
+
@end
|
|
7
|
+
|
|
8
|
+
@implementation BGSRNPluginEndpointTests
|
|
9
|
+
|
|
10
|
+
static NSString *const kDead = @"https://127.0.0.1:9/v2";
|
|
11
|
+
|
|
12
|
+
- (void)testTheInfoPlistKeyIsThePlugins {
|
|
13
|
+
XCTAssertEqualObjects(BGSRNPluginEndpointInfoKey, @"BugseeReactNativeEndpoint");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
- (void)testAddsTheConfiguredEndpointWhenJsGaveNone {
|
|
17
|
+
NSDictionary *options = @{@"com.bugsee.option.config.duration" : @5};
|
|
18
|
+
NSDictionary *result = BGSRNOptionsWithPluginEndpoint(options, [NSString stringWithFormat:@" %@\n", kDead]);
|
|
19
|
+
XCTAssertEqualObjects(result, (@{@"com.bugsee.option.config.duration" : @5, @"endpoint" : kDead}));
|
|
20
|
+
XCTAssertEqual(options.count, 1u);
|
|
21
|
+
XCTAssertEqualObjects(BGSRNOptionsWithPluginEndpoint(nil, kDead), @{@"endpoint" : kDead});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
- (void)testKeepsAnEndpointJsPassed {
|
|
25
|
+
NSDictionary *options = @{@"endpoint" : @"https://js.example.com/v2"};
|
|
26
|
+
XCTAssertEqual(BGSRNOptionsWithPluginEndpoint(options, kDead), options);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
- (void)testChangesNothingWithoutAConfiguredString {
|
|
30
|
+
NSDictionary *options = @{@"k" : @YES};
|
|
31
|
+
XCTAssertEqual(BGSRNOptionsWithPluginEndpoint(options, nil), options);
|
|
32
|
+
XCTAssertEqual(BGSRNOptionsWithPluginEndpoint(options, @""), options);
|
|
33
|
+
XCTAssertEqual(BGSRNOptionsWithPluginEndpoint(options, @" \t\n"), options);
|
|
34
|
+
XCTAssertEqual(BGSRNOptionsWithPluginEndpoint(options, @9), options);
|
|
35
|
+
XCTAssertEqualObjects(BGSRNOptionsWithPluginEndpoint(nil, nil), @{});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@end
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
@import XCTest;
|
|
2
|
+
@import UIKit;
|
|
3
|
+
@import BugseeRNSupport;
|
|
4
|
+
|
|
5
|
+
/// The tracker gives where the React root's window sits on the screen, so the
|
|
6
|
+
/// main surface's secure rectangles and the `vh` tree land where the SDK draws.
|
|
7
|
+
/// What it must never do is guess -- a made-up origin moves every region off
|
|
8
|
+
/// its view -- or walk every window on each of the SDK's pulls, which come
|
|
9
|
+
/// once per captured frame.
|
|
10
|
+
@interface BGSRNReactRootOriginTrackerTests : XCTestCase
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@implementation BGSRNReactRootOriginTrackerTests {
|
|
14
|
+
UIWindow *_window;
|
|
15
|
+
UIView *_root;
|
|
16
|
+
NSUInteger _searches;
|
|
17
|
+
NSValue *_origin;
|
|
18
|
+
NSTimeInterval _now;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
- (void)setUp {
|
|
22
|
+
[super setUp];
|
|
23
|
+
_window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
|
24
|
+
_root = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
|
|
25
|
+
[_window addSubview:_root];
|
|
26
|
+
_searches = 0;
|
|
27
|
+
_origin = [NSValue valueWithCGPoint:CGPointMake(100, 50)];
|
|
28
|
+
_now = 1000;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// Finds `_root` (or nothing once it is nil) and reads `_origin` for the
|
|
32
|
+
/// window it is in, counting the searches, on a clock the test moves.
|
|
33
|
+
- (BGSRNReactRootOriginTracker *)tracker {
|
|
34
|
+
__weak __typeof(self) weakSelf = self;
|
|
35
|
+
return [[BGSRNReactRootOriginTracker alloc]
|
|
36
|
+
initWithFindRoot:^UIView * {
|
|
37
|
+
__typeof(self) strongSelf = weakSelf;
|
|
38
|
+
strongSelf->_searches += 1;
|
|
39
|
+
return strongSelf->_root;
|
|
40
|
+
}
|
|
41
|
+
readOrigin:^NSValue *(UIWindow *window) {
|
|
42
|
+
__typeof(self) strongSelf = weakSelf;
|
|
43
|
+
return window == strongSelf->_root.window ? strongSelf->_origin : nil;
|
|
44
|
+
}
|
|
45
|
+
clock:^NSTimeInterval {
|
|
46
|
+
__typeof(self) strongSelf = weakSelf;
|
|
47
|
+
return strongSelf ? strongSelf->_now : 0;
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (NSValue *)at:(CGFloat)x :(CGFloat)y {
|
|
52
|
+
return [NSValue valueWithCGPoint:CGPointMake(x, y)];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)testGivesTheWindowsPlace {
|
|
56
|
+
XCTAssertEqualObjects([[self tracker] originFindingTheRoot], [self at:100 :50]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// A window dragged across the screen: a pull re-reads its place through the
|
|
60
|
+
/// root it already has, without a search.
|
|
61
|
+
- (void)testAPullFollowsTheWindowOfTheRootFoundLast {
|
|
62
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
63
|
+
[tracker originFindingTheRoot];
|
|
64
|
+
|
|
65
|
+
_origin = [self at:200 :80];
|
|
66
|
+
|
|
67
|
+
XCTAssertEqualObjects([tracker origin], [self at:200 :80]);
|
|
68
|
+
XCTAssertEqual(_searches, 1u);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// The SDK pulls once per captured frame on the main thread. With no React
|
|
72
|
+
/// root on screen (a brownfield app's native screens) a search on each pull
|
|
73
|
+
/// would walk every window to its budget each time.
|
|
74
|
+
- (void)testPullsWithNoRootSearchAtMostOncePerInterval {
|
|
75
|
+
_root = nil;
|
|
76
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
77
|
+
|
|
78
|
+
XCTAssertNil([tracker origin]);
|
|
79
|
+
XCTAssertNil([tracker origin]);
|
|
80
|
+
_now += BGSRNReactRootSearchMinInterval / 2;
|
|
81
|
+
XCTAssertNil([tracker origin]);
|
|
82
|
+
XCTAssertEqual(_searches, 1u);
|
|
83
|
+
|
|
84
|
+
_now += BGSRNReactRootSearchMinInterval;
|
|
85
|
+
XCTAssertNil([tracker origin]);
|
|
86
|
+
XCTAssertEqual(_searches, 2u);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// A pull still finds a root that was not there before, at the next interval:
|
|
90
|
+
/// a main surface with rectangles and no origin serves the whole screen.
|
|
91
|
+
- (void)testAPullFindsARootThatAppearedLater {
|
|
92
|
+
UIView *root = _root;
|
|
93
|
+
_root = nil;
|
|
94
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
95
|
+
XCTAssertNil([tracker origin]);
|
|
96
|
+
|
|
97
|
+
_root = root;
|
|
98
|
+
_now += BGSRNReactRootSearchMinInterval;
|
|
99
|
+
|
|
100
|
+
XCTAssertEqualObjects([tracker origin], [self at:100 :50]);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// A JS publish or a `vh` request does not wait for the interval.
|
|
104
|
+
- (void)testFindingTheRootSearchesAtOnce {
|
|
105
|
+
UIView *root = _root;
|
|
106
|
+
_root = nil;
|
|
107
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
108
|
+
XCTAssertNil([tracker origin]);
|
|
109
|
+
|
|
110
|
+
_root = root;
|
|
111
|
+
|
|
112
|
+
XCTAssertEqualObjects([tracker originFindingTheRoot], [self at:100 :50]);
|
|
113
|
+
XCTAssertEqual(_searches, 2u);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
- (void)testDoesNotSearchWhileTheRootIsInAWindow {
|
|
117
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
118
|
+
[tracker originFindingTheRoot];
|
|
119
|
+
|
|
120
|
+
[tracker originFindingTheRoot];
|
|
121
|
+
[tracker origin];
|
|
122
|
+
|
|
123
|
+
XCTAssertEqual(_searches, 1u);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/// A reload replaces the root; the next search finds the new one.
|
|
127
|
+
- (void)testSearchesAgainOnceTheRootHasLeftItsWindow {
|
|
128
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
129
|
+
[tracker originFindingTheRoot];
|
|
130
|
+
[_root removeFromSuperview];
|
|
131
|
+
_root = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
|
|
132
|
+
[_window addSubview:_root];
|
|
133
|
+
|
|
134
|
+
XCTAssertEqualObjects([tracker originFindingTheRoot], [self at:100 :50]);
|
|
135
|
+
XCTAssertEqual(_searches, 2u);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// A window off its screen for a moment (a scene disconnecting) has no place:
|
|
139
|
+
/// nil, and the caller keeps the origin it has rather than serve the regions
|
|
140
|
+
/// at the window's own corner.
|
|
141
|
+
- (void)testNoOriginWhenThePlaceCannotBeRead {
|
|
142
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
143
|
+
[tracker originFindingTheRoot];
|
|
144
|
+
|
|
145
|
+
_origin = nil;
|
|
146
|
+
|
|
147
|
+
XCTAssertNil([tracker origin]);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
- (void)testNoOriginWhenNoRootIsFound {
|
|
151
|
+
_root = nil;
|
|
152
|
+
|
|
153
|
+
XCTAssertNil([[self tracker] originFindingTheRoot]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/// The tracker keeps the root weakly: a reload's old root must go.
|
|
157
|
+
- (void)testDoesNotKeepTheRootAlive {
|
|
158
|
+
BGSRNReactRootOriginTracker *tracker = [self tracker];
|
|
159
|
+
__weak UIView *weakRoot = nil;
|
|
160
|
+
@autoreleasepool {
|
|
161
|
+
UIView *root = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
|
|
162
|
+
[_window addSubview:root];
|
|
163
|
+
_root = root;
|
|
164
|
+
weakRoot = root;
|
|
165
|
+
[tracker originFindingTheRoot];
|
|
166
|
+
[root removeFromSuperview];
|
|
167
|
+
_root = nil;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
XCTAssertNil(weakRoot);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/// They run inside the SDK's pull, where an exception would take the host
|
|
174
|
+
/// app down over a redaction offset.
|
|
175
|
+
- (void)testSwallowsAnExceptionFromTheSearch {
|
|
176
|
+
BGSRNReactRootOriginTracker *tracker = [[BGSRNReactRootOriginTracker alloc]
|
|
177
|
+
initWithFindRoot:^UIView * {
|
|
178
|
+
[NSException raise:@"Test" format:@"search"];
|
|
179
|
+
return nil;
|
|
180
|
+
}
|
|
181
|
+
readOrigin:^NSValue *(UIWindow *window) {
|
|
182
|
+
return nil;
|
|
183
|
+
}
|
|
184
|
+
clock:^NSTimeInterval {
|
|
185
|
+
return 0;
|
|
186
|
+
}];
|
|
187
|
+
|
|
188
|
+
XCTAssertNoThrow([tracker originFindingTheRoot]);
|
|
189
|
+
XCTAssertNil([tracker originFindingTheRoot]);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
- (void)testSwallowsAnExceptionFromReadingThePlace {
|
|
193
|
+
UIView *root = _root;
|
|
194
|
+
BGSRNReactRootOriginTracker *tracker = [[BGSRNReactRootOriginTracker alloc]
|
|
195
|
+
initWithFindRoot:^UIView * {
|
|
196
|
+
return root;
|
|
197
|
+
}
|
|
198
|
+
readOrigin:^NSValue *(UIWindow *window) {
|
|
199
|
+
[NSException raise:@"Test" format:@"read"];
|
|
200
|
+
return nil;
|
|
201
|
+
}
|
|
202
|
+
clock:^NSTimeInterval {
|
|
203
|
+
return 0;
|
|
204
|
+
}];
|
|
205
|
+
|
|
206
|
+
XCTAssertNoThrow([tracker originFindingTheRoot]);
|
|
207
|
+
XCTAssertNil([tracker originFindingTheRoot]);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@end
|