Skip to content

Commit d43b172

Browse files
Add merge tests
1 parent 5dc939f commit d43b172

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/integrations/expocontext.test.ts

+46
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,52 @@ describe('Expo Context Integration', () => {
6666
});
6767
});
6868

69+
it('merge existing event device context with expo', async () => {
70+
(getExpoDevice as jest.Mock).mockReturnValue({
71+
deviceName: 'test device name',
72+
simulator: true,
73+
modelName: 'test model name',
74+
manufacturer: 'test manufacturer',
75+
totalMemory: 1000,
76+
});
77+
const actualEvent = await executeIntegrationFor({
78+
contexts: {
79+
device: {
80+
name: 'existing device name',
81+
},
82+
},
83+
});
84+
85+
expect(actualEvent.contexts?.device).toStrictEqual({
86+
name: 'existing device name',
87+
simulator: true,
88+
model: 'test model name',
89+
manufacturer: 'test manufacturer',
90+
memory_size: 1000,
91+
});
92+
});
93+
94+
it('merge existing event os context with expo', async () => {
95+
(getExpoDevice as jest.Mock).mockReturnValue({
96+
osName: 'test os name',
97+
osBuildId: 'test os build id',
98+
osVersion: 'test os version',
99+
});
100+
const actualEvent = await executeIntegrationFor({
101+
contexts: {
102+
os: {
103+
name: 'existing os name',
104+
},
105+
},
106+
});
107+
108+
expect(actualEvent.contexts?.os).toStrictEqual({
109+
name: 'existing os name',
110+
build: 'test os build id',
111+
version: 'test os version',
112+
});
113+
});
114+
69115
function executeIntegrationFor(mockedEvent: Event): Promise<Event | null> {
70116
return new Promise((resolve, reject) => {
71117
integration.setupOnce(async eventProcessor => {

0 commit comments

Comments
 (0)