File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
example/ios/InstabugTests Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -612,21 +612,19 @@ - (void)testisW3CFeatureFlagsEnabled {
612612}
613613
614614- (void )testGetNetworkBodyMaxSize {
615- id mock = OCMClassMock ([IBGNetworkLogger class ]);
616615 double expectedValue = 10240.0 ;
616+ XCTestExpectation *expectation = [self expectationWithDescription: @" Call completion handler" ];
617+
618+ OCMStub ([self .mNetworkLogger getNetworkBodyMaxSize ]).andReturn (expectedValue);
617619
618- OCMStub ([mock getNetworkBodyMaxSize ]).andReturn (expectedValue);
619-
620- XCTestExpectation *expectation = [self expectationWithDescription: @" Call resolve block" ];
621- RCTPromiseResolveBlock resolve = ^(NSNumber *result) {
622- XCTAssertEqual (result.doubleValue , expectedValue);
620+ [self .api getNetworkBodyMaxSizeWithCompletion: ^(NSNumber *actual, FlutterError *error) {
623621 [expectation fulfill ];
624- };
625-
626- [self .instabugBridge getNetworkBodyMaxSize: resolve :nil ];
627- [self waitForExpectationsWithTimeout: 1.0 handler: nil ];
622+ XCTAssertEqual (actual.doubleValue , expectedValue);
623+ XCTAssertNil (error);
624+ }];
628625
629- OCMVerify (ClassMethod ([mock getNetworkBodyMaxSize ]));
626+ OCMVerify ([self .mNetworkLogger getNetworkBodyMaxSize ]);
627+ [self waitForExpectations: @[expectation] timeout: 5.0 ];
630628}
631629
632630@end
Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ void main() {
7878 "isW3cCaughtHeaderEnabled" : true ,
7979 }),
8080 );
81+ when (mHost.getNetworkBodyMaxSize ()).thenAnswer (
82+ (_) => Future .value (10240 ),
83+ );
8184 await Instabug .init (
8285 token: token,
8386 invocationEvents: events,
You can’t perform that action at this time.
0 commit comments