Skip to content

Commit e2e3663

Browse files
committed
Fix Android Test
1 parent 1658e6f commit e2e3663

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

android/src/test/java/com/instabug/reactlibrary/RNInstabugBugReportingModuleTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,24 @@ public Object answer(InvocationOnMock invocation) {
250250
// given
251251
MockedStatic mockArgument = mockStatic(Arguments.class);
252252
MockedStatic mockReactApplicationContext = mockStatic(ReactApplicationContext.class);
253+
final OnSdkDismissCallback.DismissType dismissType = OnSdkDismissCallback.DismissType.CANCEL;
254+
final OnSdkDismissCallback.ReportType reportType = OnSdkDismissCallback.ReportType.BUG;
253255

254256
// when
255257
when(Arguments.createMap()).thenReturn(new JavaOnlyMap());
256258
mockBugReporting.when(() -> BugReporting.setOnDismissCallback(any(OnSdkDismissCallback.class))).thenAnswer(new Answer() {
257259
public Object answer(InvocationOnMock invocation) {
258260
((OnSdkDismissCallback) invocation.getArguments()[0])
259-
.call(OnSdkDismissCallback.DismissType.CANCEL, OnSdkDismissCallback.ReportType.BUG);
261+
.call(dismissType, reportType);
260262
return null;
261263
}});
262264
bugReportingModule.setOnDismissHandler(null);
263265

264266
// then
265267
WritableMap params = new JavaOnlyMap();
266-
params.putString("dismissType", OnSdkDismissCallback.DismissType.CANCEL.toString());
267-
params.putString("reportType", OnSdkDismissCallback.ReportType.BUG.toString());
268+
params.putString("dismissType", ArgsRegistry.dismissTypes.getKey(dismissType));
269+
params.putString("reportType", ArgsRegistry.sdkDismissReportTypes.getKey(reportType));
270+
268271
verify(bugReportingModule).sendEvent(Constants.IBG_POST_INVOCATION_HANDLER, params);
269272
mockArgument.close();
270273
mockReactApplicationContext.close();

0 commit comments

Comments
 (0)