Skip to content

Commit a822d5a

Browse files
author
AliAbdelfattah
authored
Merge pull request #339 from Instabug/specs/ios-chats-module
Specs/ios chats module
2 parents 3e96106 + 4d5097e commit a822d5a

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

InstabugSample/ios/InstabugSampleTests/InstabugSampleTests.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,5 +534,35 @@ - (void)testSetCrashReportingEnabled {
534534
XCTAssertFalse(IBGCrashReporting.enabled);
535535
}
536536

537+
/*
538+
+------------------------------------------------------------------------+
539+
| Chats Module |
540+
+------------------------------------------------------------------------+
541+
*/
542+
543+
- (void)testSetChatsEnabled {
544+
id mock = OCMClassMock([Instabug class]);
545+
546+
[self.instabugBridge setChatsEnabled:YES];
547+
XCTAssertTrue(IBGChats.enabled);
548+
549+
[self.instabugBridge setChatsEnabled:NO];
550+
XCTAssertFalse(IBGChats.enabled);
551+
}
552+
553+
- (void)testShowChats {
554+
id mock = OCMClassMock([IBGChats class]);
555+
XCTestExpectation *expectation = [self expectationWithDescription:@"Testing [IBGChats showChats]"];
556+
557+
OCMStub([mock show]);
558+
[self.instabugBridge showChats];
559+
560+
[[NSRunLoop mainRunLoop] performBlock:^{
561+
OCMVerify([mock show]);
562+
[expectation fulfill];
563+
}];
564+
565+
[self waitForExpectationsWithTimeout:EXPECTATION_TIMEOUT handler:nil];
566+
}
537567

538568
@end

ios/RNInstabug/InstabugReactBridge.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,13 @@
127127

128128
- (void)setCrashReportingEnabled:(BOOL)enabledCrashReporter;
129129

130+
/*
131+
+------------------------------------------------------------------------+
132+
| Chats Module |
133+
+------------------------------------------------------------------------+
134+
*/
135+
136+
- (void)setChatsEnabled:(BOOL)isEnabled;
137+
- (void)showChats;
138+
130139
@end

0 commit comments

Comments
 (0)