File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
packages/google-cloud-serverless Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ export interface CloudFunctionsContext {
29
29
30
30
export interface CloudEventsContext {
31
31
[ key : string ] : any ; // eslint-disable-line @typescript-eslint/no-explicit-any
32
+ id : string ;
33
+ specversion : string ;
32
34
type ?: string ;
33
- specversion ?: string ;
34
35
source ?: string ;
35
- id ?: string ;
36
36
time ?: string ;
37
37
schemaurl ?: string ;
38
38
contenttype ?: string ;
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ describe('wrapCloudEventFunction', () => {
45
45
function handleCloudEvent ( fn : CloudEventFunctionWithCallback ) : Promise < any > {
46
46
return new Promise ( ( resolve , reject ) => {
47
47
const context = {
48
+ id : 'test-event-id' ,
49
+ specversion : '1.0' ,
48
50
type : 'event.type' ,
49
51
} ;
50
52
@@ -232,6 +234,10 @@ describe('wrapCloudEventFunction', () => {
232
234
const handler : CloudEventFunction = _context => 42 ;
233
235
const wrappedHandler = wrapCloudEventFunction ( handler ) ;
234
236
await handleCloudEvent ( wrappedHandler ) ;
235
- expect ( mockScope . setContext ) . toBeCalledWith ( 'gcp.function.context' , { type : 'event.type' } ) ;
237
+ expect ( mockScope . setContext ) . toBeCalledWith ( 'gcp.function.context' , {
238
+ id : 'test-event-id' ,
239
+ specversion : '1.0' ,
240
+ type : 'event.type' ,
241
+ } ) ;
236
242
} ) ;
237
243
} ) ;
You can’t perform that action at this time.
0 commit comments