Skip to content

Commit bd61fa7

Browse files
committed
Fix iOS Test
1 parent 4b61ed9 commit bd61fa7

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

example/ios/InstabugSampleTests/InstabugBugReportingTests.m

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,49 @@ - (void) testgivenHandler$setOnInvokeHandler_whenQuery_thenShouldCallNativeApi {
7272

7373
- (void) testgivenHandlerCANCEL$setOnDismissHandler_whenQuery_thenShouldCallNativeApi {
7474
id partialMock = OCMPartialMock(self.instabugBridge);
75+
IBGDismissType dismissType = IBGDismissTypeCancel;
76+
IBGReportType reportType = IBGReportTypeBug;
77+
7578
RCTResponseSenderBlock callback = ^(NSArray *response) {};
7679
[partialMock setOnDismissHandler:callback];
7780
XCTAssertNotNil(IBGBugReporting.didDismissHandler);
78-
NSDictionary *result = @{ @"dismissType": @"CANCEL",
79-
@"reportType": @"bug"};
81+
NSDictionary *result = @{ @"dismissType": @(dismissType),
82+
@"reportType": @(reportType)};
83+
8084
OCMStub([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
81-
IBGBugReporting.didDismissHandler(IBGDismissTypeCancel,IBGReportTypeBug);
85+
IBGBugReporting.didDismissHandler(dismissType, reportType);
8286
OCMVerify([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
8387
}
8488

8589
- (void) testgivenHandlerSUBMIT$setOnDismissHandler_whenQuery_thenShouldCallNativeApi {
8690
id partialMock = OCMPartialMock(self.instabugBridge);
91+
IBGDismissType dismissType = IBGDismissTypeSubmit;
92+
IBGReportType reportType = IBGReportTypeFeedback;
93+
8794
RCTResponseSenderBlock callback = ^(NSArray *response) {};
8895
[partialMock setOnDismissHandler:callback];
8996
XCTAssertNotNil(IBGBugReporting.didDismissHandler);
90-
91-
NSDictionary *result = @{ @"dismissType": @"SUBMIT",
92-
@"reportType": @"feedback"};
97+
NSDictionary *result = @{ @"dismissType": @(dismissType),
98+
@"reportType": @(reportType)};
99+
93100
OCMStub([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
94-
IBGBugReporting.didDismissHandler(IBGDismissTypeSubmit,IBGReportTypeFeedback);
101+
IBGBugReporting.didDismissHandler(dismissType, reportType);
95102
OCMVerify([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
96103
}
97104

98105
- (void) testgivenHandlerADD_ATTACHMENT$setOnDismissHandler_whenQuery_thenShouldCallNativeApi {
99106
id partialMock = OCMPartialMock(self.instabugBridge);
107+
IBGDismissType dismissType = IBGDismissTypeAddAttachment;
108+
IBGReportType reportType = IBGReportTypeFeedback;
109+
100110
RCTResponseSenderBlock callback = ^(NSArray *response) {};
101111
[partialMock setOnDismissHandler:callback];
102112
XCTAssertNotNil(IBGBugReporting.didDismissHandler);
103-
NSDictionary *result = @{ @"dismissType": @"ADD_ATTACHMENT",
104-
@"reportType": @"feedback"};
113+
NSDictionary *result = @{ @"dismissType": @(dismissType),
114+
@"reportType": @(reportType)};
115+
105116
OCMStub([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
106-
IBGBugReporting.didDismissHandler(IBGDismissTypeAddAttachment,IBGReportTypeFeedback);
117+
IBGBugReporting.didDismissHandler(dismissType, reportType);
107118
OCMVerify([partialMock sendEventWithName:@"IBGpostInvocationHandler" body:result]);
108119
}
109120

0 commit comments

Comments
 (0)