Skip to content

Commit c718728

Browse files
author
Ali Abdelfattah
authored
Merge pull request #616 from Instabug/fix/crashReporting-test
Fix/crash reporting test
2 parents 16030a4 + 5f3192c commit c718728

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

__tests__/crashReporting.spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ describe('CrashReporting Module', () => {
4444
it('should call the native method sendHandledJSCrash when platform is ios', () => {
4545

4646
Platform.OS = 'ios';
47-
InstabugUtils.parseErrorStack.mockImplementation(() => 'javascriptStackTrace');
4847
const errorObject = { name: 'TypeError', message: 'Invalid type' };
4948
CrashReporting.reportJSException(errorObject);
5049

@@ -62,7 +61,6 @@ describe('CrashReporting Module', () => {
6261
it('should call the native method sendHandledJSCrash when platform is android', () => {
6362

6463
Platform.OS = 'android';
65-
InstabugUtils.parseErrorStack.mockImplementation(() => 'javascriptStackTrace');
6664
const errorObject = { name: 'TypeError', message: 'Invalid type' };
6765
CrashReporting.reportJSException(errorObject);
6866

@@ -81,7 +79,6 @@ describe('CrashReporting Module', () => {
8179
it('should emit event IBGSendHandledJSCrash with the error object when platform is android', (done) => {
8280

8381
Platform.OS = 'android';
84-
InstabugUtils.parseErrorStack.mockImplementation(() => 'javascriptStackTrace');
8582
InstabugUtils.isOnReportHandlerSet.mockImplementation(() => true);
8683

8784
const errorObject = { name: 'TypeError', message: 'Invalid type' };

jest/mockInstabugUtils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ jest.mock('../utils/InstabugUtils', () => {
44
captureJsErrors: jest.fn(),
55
setOnReportHandler: jest.fn(),
66
isOnReportHandlerSet: jest.fn(),
7-
getActiveRouteName: jest.fn()
7+
getActiveRouteName: jest.fn(),
8+
getStackTrace: jest.fn(() => 'javascriptStackTrace')
89
}
910
});

0 commit comments

Comments
 (0)