@@ -66,6 +66,52 @@ describe('Expo Context Integration', () => {
66
66
} ) ;
67
67
} ) ;
68
68
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
+
69
115
function executeIntegrationFor ( mockedEvent : Event ) : Promise < Event | null > {
70
116
return new Promise ( ( resolve , reject ) => {
71
117
integration . setupOnce ( async eventProcessor => {
0 commit comments