Skip to content

Commit 6aa81c4

Browse files
fix(expo-context): Rename expo_updates to ota_updates (#4786)
1 parent b0a7066 commit 6aa81c4

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
### Features
1212

13-
- Add Expo Updates Event Context ([#4767](https://github.com/getsentry/sentry-react-native/pull/4767))
13+
- Add Expo Updates Event Context ([#4767](https://github.com/getsentry/sentry-react-native/pull/4767), [#4786](https://github.com/getsentry/sentry-react-native/pull/4786))
1414
- Automatically collects `updateId`, `channel`, Emergency Launch Reason and other Expo Updates constants
1515

1616
### Fixes

packages/core/src/js/integrations/expocontext.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { NATIVE } from '../wrapper';
66

77
const INTEGRATION_NAME = 'ExpoContext';
88

9-
export const EXPO_UPDATES_CONTEXT_KEY = 'expo_updates';
9+
export const OTA_UPDATES_CONTEXT_KEY = 'ota_updates';
1010

1111
/** Load device context from expo modules. */
1212
export const expoContextIntegration = (): Integration => {
@@ -25,7 +25,7 @@ export const expoContextIntegration = (): Integration => {
2525

2626
try {
2727
// Ensures native errors and crashes have the same context as JS errors
28-
NATIVE.setContext(EXPO_UPDATES_CONTEXT_KEY, expoUpdates);
28+
NATIVE.setContext(OTA_UPDATES_CONTEXT_KEY, expoUpdates);
2929
} catch (error) {
3030
logger.error('Error setting Expo updates context:', error);
3131
}
@@ -43,7 +43,7 @@ export const expoContextIntegration = (): Integration => {
4343

4444
function addExpoUpdatesContext(event: Event): void {
4545
event.contexts = event.contexts || {};
46-
event.contexts[EXPO_UPDATES_CONTEXT_KEY] = {
46+
event.contexts[OTA_UPDATES_CONTEXT_KEY] = {
4747
...getExpoUpdatesContextCached(),
4848
};
4949
}

packages/core/test/integrations/expocontext.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Client, Event } from '@sentry/core';
22

3-
import { EXPO_UPDATES_CONTEXT_KEY, expoContextIntegration } from '../../src/js/integrations/expocontext';
3+
import { expoContextIntegration, OTA_UPDATES_CONTEXT_KEY } from '../../src/js/integrations/expocontext';
44
import * as environment from '../../src/js/utils/environment';
55
import type { ExpoUpdates } from '../../src/js/utils/expoglobalobject';
66
import { getExpoDevice } from '../../src/js/utils/expomodules';
@@ -21,7 +21,7 @@ describe('Expo Context Integration', () => {
2121
it('does not add expo updates context', () => {
2222
const actualEvent = executeIntegrationFor({});
2323

24-
expect(actualEvent.contexts?.[EXPO_UPDATES_CONTEXT_KEY]).toBeUndefined();
24+
expect(actualEvent.contexts?.[OTA_UPDATES_CONTEXT_KEY]).toBeUndefined();
2525
});
2626
});
2727

@@ -48,15 +48,15 @@ describe('Expo Context Integration', () => {
4848
const event1 = await integration.processEvent!({}, {}, {} as Client);
4949
const event2 = await integration.processEvent!({}, {}, {} as Client);
5050

51-
expect(event1.contexts![EXPO_UPDATES_CONTEXT_KEY]).not.toBe(event2.contexts![EXPO_UPDATES_CONTEXT_KEY]);
51+
expect(event1.contexts![OTA_UPDATES_CONTEXT_KEY]).not.toBe(event2.contexts![OTA_UPDATES_CONTEXT_KEY]);
5252
});
5353

5454
it('adds isEnabled false if ExpoUpdates module is missing', () => {
5555
jest.spyOn(expoModules, 'getExpoUpdates').mockReturnValue(undefined);
5656

5757
const actualEvent = executeIntegrationFor({});
5858

59-
expect(actualEvent.contexts?.[EXPO_UPDATES_CONTEXT_KEY]).toStrictEqual({
59+
expect(actualEvent.contexts?.[OTA_UPDATES_CONTEXT_KEY]).toStrictEqual({
6060
is_enabled: false,
6161
});
6262
});
@@ -66,7 +66,7 @@ describe('Expo Context Integration', () => {
6666

6767
const actualEvent = executeIntegrationFor({});
6868

69-
expect(actualEvent.contexts?.[EXPO_UPDATES_CONTEXT_KEY]).toStrictEqual({
69+
expect(actualEvent.contexts?.[OTA_UPDATES_CONTEXT_KEY]).toStrictEqual({
7070
is_enabled: false,
7171
is_embedded_launch: false,
7272
is_emergency_launch: false,
@@ -87,7 +87,7 @@ describe('Expo Context Integration', () => {
8787

8888
const actualEvent = executeIntegrationFor({});
8989

90-
expect(actualEvent.contexts?.[EXPO_UPDATES_CONTEXT_KEY]).toEqual({
90+
expect(actualEvent.contexts?.[OTA_UPDATES_CONTEXT_KEY]).toEqual({
9191
is_enabled: false,
9292
is_embedded_launch: false,
9393
is_emergency_launch: false,
@@ -115,7 +115,7 @@ describe('Expo Context Integration', () => {
115115

116116
const actualEvent = executeIntegrationFor({});
117117

118-
expect(actualEvent.contexts?.[EXPO_UPDATES_CONTEXT_KEY]).toStrictEqual({
118+
expect(actualEvent.contexts?.[OTA_UPDATES_CONTEXT_KEY]).toStrictEqual({
119119
is_enabled: false,
120120
is_embedded_launch: false,
121121
is_emergency_launch: false,
@@ -141,7 +141,7 @@ describe('Expo Context Integration', () => {
141141

142142
const actualEvent = executeIntegrationFor({});
143143

144-
expect(actualEvent.contexts?.[EXPO_UPDATES_CONTEXT_KEY]).toStrictEqual({
144+
expect(actualEvent.contexts?.[OTA_UPDATES_CONTEXT_KEY]).toStrictEqual({
145145
is_enabled: true,
146146
is_embedded_launch: false,
147147
is_emergency_launch: false,

0 commit comments

Comments
 (0)