Skip to content

Commit 7945171

Browse files
committed
fix: fix ios and flutter failing tests
1 parent 87b7736 commit 7945171

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

example/ios/InstabugTests/InstabugApiTests.m

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff 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

test/instabug_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
 (0)