Skip to content

Commit e7a016f

Browse files
committed
Merge branch 'main' into feedback-ui-2
# Conflicts: # CHANGELOG.md
2 parents 469134d + deae061 commit e7a016f

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
### Fixes
1818

19+
- crashedLastRun now returns the correct value ([#4829](https://github.com/getsentry/sentry-react-native/pull/4829))
1920
- Fixes Feedback Widget accessibility issue on iOS ([#4739](https://github.com/getsentry/sentry-react-native/pull/4739))
2021

2122
## 6.14.0

packages/core/src/js/wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ export const NATIVE: SentryNativeWrapper = {
697697
return null;
698698
}
699699

700-
const result = RNSentry.crashedLastRun();
700+
const result = await RNSentry.crashedLastRun();
701701
return typeof result === 'boolean' ? result : null;
702702
},
703703

packages/core/test/wrapper.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jest.mock('react-native', () => {
1414
addBreadcrumb: jest.fn(),
1515
captureEnvelope: jest.fn(),
1616
clearBreadcrumbs: jest.fn(),
17+
crashedLastRun: jest.fn(),
1718
crash: jest.fn(),
1819
fetchNativeDeviceContexts: jest.fn(() =>
1920
Promise.resolve({
@@ -784,4 +785,27 @@ describe('Tests Native Wrapper', () => {
784785
expect(RNSentry.setContext).toHaveBeenCalledOnce();
785786
});
786787
});
788+
789+
describe('crashedLastRun', () => {
790+
test('return true when promise resolves true ', async () => {
791+
(RNSentry.crashedLastRun as jest.Mock).mockResolvedValue(true);
792+
793+
const result = await NATIVE.crashedLastRun();
794+
expect(result).toBeTrue();
795+
});
796+
797+
test('return true when promise resolves false ', async () => {
798+
(RNSentry.crashedLastRun as jest.Mock).mockResolvedValue(false);
799+
800+
const result = await NATIVE.crashedLastRun();
801+
expect(result).toBeFalse();
802+
});
803+
804+
test('return null when promise does not resolve ', async () => {
805+
(RNSentry.crashedLastRun as jest.Mock).mockResolvedValue(undefined);
806+
807+
const result = await NATIVE.crashedLastRun();
808+
expect(result).toBeNull();
809+
});
810+
});
787811
});

0 commit comments

Comments
 (0)