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 {
2929
3030export interface CloudEventsContext {
3131 [ key : string ] : any ; // eslint-disable-line @typescript-eslint/no-explicit-any
32+ id : string ;
33+ specversion : string ;
3234 type ?: string ;
33- specversion ?: string ;
3435 source ?: string ;
35- id ?: string ;
3636 time ?: string ;
3737 schemaurl ?: string ;
3838 contenttype ?: string ;
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ describe('wrapCloudEventFunction', () => {
4545 function handleCloudEvent ( fn : CloudEventFunctionWithCallback ) : Promise < any > {
4646 return new Promise ( ( resolve , reject ) => {
4747 const context = {
48+ id : 'test-event-id' ,
49+ specversion : '1.0' ,
4850 type : 'event.type' ,
4951 } ;
5052
@@ -232,6 +234,10 @@ describe('wrapCloudEventFunction', () => {
232234 const handler : CloudEventFunction = _context => 42 ;
233235 const wrappedHandler = wrapCloudEventFunction ( handler ) ;
234236 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+ } ) ;
236242 } ) ;
237243} ) ;
You can’t perform that action at this time.
0 commit comments