@@ -61,7 +61,7 @@ describe('request to HTTP function', () => {
61
61
62
62
testData . forEach ( test => {
63
63
it ( `should return transformed body: ${ test . name } ` , async ( ) => {
64
- var callCount = 0 ;
64
+ let callCount = 0 ;
65
65
const server = getServer (
66
66
( req : express . Request , res : express . Response ) => {
67
67
++ callCount ;
@@ -71,7 +71,7 @@ describe('request to HTTP function', () => {
71
71
) ;
72
72
await supertest ( server )
73
73
. post ( test . path )
74
- . send ( { text : 'hello' } )
74
+ . send ( { text : 'hello' } )
75
75
. set ( 'Content-Type' , 'application/json' )
76
76
. expect ( test . text )
77
77
. expect ( test . status ) ;
@@ -96,7 +96,7 @@ describe('GCF event request to event function', () => {
96
96
eventType : 'testEventType' ,
97
97
resource : 'testResource' ,
98
98
} ,
99
- data : { some : 'payload' } ,
99
+ data : { some : 'payload' } ,
100
100
} ,
101
101
expectedResource : 'testResource' ,
102
102
} ,
@@ -107,7 +107,7 @@ describe('GCF event request to event function', () => {
107
107
timestamp : 'testTimestamp' ,
108
108
eventType : 'testEventType' ,
109
109
resource : 'testResource' ,
110
- data : { some : 'payload' } ,
110
+ data : { some : 'payload' } ,
111
111
} ,
112
112
expectedResource : 'testResource' ,
113
113
} ,
@@ -124,7 +124,7 @@ describe('GCF event request to event function', () => {
124
124
type : 'testType' ,
125
125
} ,
126
126
} ,
127
- data : { some : 'payload' } ,
127
+ data : { some : 'payload' } ,
128
128
} ,
129
129
expectedResource : {
130
130
service : 'testService' ,
@@ -137,19 +137,16 @@ describe('GCF event request to event function', () => {
137
137
it ( `should receive data and context from ${ test . name } ` , async ( ) => {
138
138
let receivedData : { } | null = null ;
139
139
let receivedContext : functions . CloudFunctionsContext | null = null ;
140
- const server = getServer (
141
- ( data : { } , context : functions . Context ) => {
142
- receivedData = data ;
143
- receivedContext = context as functions . CloudFunctionsContext ;
144
- } ,
145
- SignatureType . EVENT
146
- ) ;
140
+ const server = getServer ( ( data : { } , context : functions . Context ) => {
141
+ receivedData = data ;
142
+ receivedContext = context as functions . CloudFunctionsContext ;
143
+ } , SignatureType . EVENT ) ;
147
144
await supertest ( server )
148
145
. post ( '/' )
149
146
. send ( test . body )
150
147
. set ( 'Content-Type' , 'application/json' )
151
148
. expect ( 204 ) ;
152
- assert . deepStrictEqual ( receivedData , { some : 'payload' } ) ;
149
+ assert . deepStrictEqual ( receivedData , { some : 'payload' } ) ;
153
150
assert . notStrictEqual ( receivedContext , null ) ;
154
151
assert . strictEqual ( receivedContext ! . eventId , 'testEventId' ) ;
155
152
assert . strictEqual ( receivedContext ! . timestamp , 'testTimestamp' ) ;
@@ -175,14 +172,14 @@ const TEST_CLOUD_EVENT = {
175
172
describe ( 'CloudEvents request to event function' , ( ) => {
176
173
interface TestData {
177
174
name : string ;
178
- headers : { [ key : string ] : string } ;
175
+ headers : { [ key : string ] : string } ;
179
176
body : { } ;
180
177
}
181
178
182
179
const testData : TestData [ ] = [
183
180
{
184
181
name : 'CloudEvents v1.0 structured content mode' ,
185
- headers : { 'Content-Type' : 'application/cloudevents+json' } ,
182
+ headers : { 'Content-Type' : 'application/cloudevents+json' } ,
186
183
body : TEST_CLOUD_EVENT ,
187
184
} ,
188
185
{
@@ -204,13 +201,10 @@ describe('CloudEvents request to event function', () => {
204
201
it ( `should receive data and context from ${ test . name } ` , async ( ) => {
205
202
let receivedData : { } | null = null ;
206
203
let receivedContext : functions . CloudEventsContext | null = null ;
207
- const server = getServer (
208
- ( data : { } , context : functions . Context ) => {
209
- receivedData = data ;
210
- receivedContext = context as functions . CloudEventsContext ;
211
- } ,
212
- SignatureType . EVENT
213
- ) ;
204
+ const server = getServer ( ( data : { } , context : functions . Context ) => {
205
+ receivedData = data ;
206
+ receivedContext = context as functions . CloudEventsContext ;
207
+ } , SignatureType . EVENT ) ;
214
208
await supertest ( server )
215
209
. post ( '/' )
216
210
. set ( test . headers )
@@ -238,14 +232,14 @@ describe('CloudEvents request to event function', () => {
238
232
describe ( 'CloudEvents request to cloudevent function' , ( ) => {
239
233
interface TestData {
240
234
name : string ;
241
- headers : { [ key : string ] : string } ;
235
+ headers : { [ key : string ] : string } ;
242
236
body : { } ;
243
237
}
244
238
245
239
const testData : TestData [ ] = [
246
240
{
247
241
name : 'CloudEvents v1.0 structured content mode' ,
248
- headers : { 'Content-Type' : 'application/cloudevents+json' } ,
242
+ headers : { 'Content-Type' : 'application/cloudevents+json' } ,
249
243
body : TEST_CLOUD_EVENT ,
250
244
} ,
251
245
{
@@ -266,12 +260,9 @@ describe('CloudEvents request to cloudevent function', () => {
266
260
testData . forEach ( test => {
267
261
it ( `should receive data and context from ${ test . name } ` , async ( ) => {
268
262
let receivedCloudEvent : functions . CloudEventsContext | null = null ;
269
- const server = getServer (
270
- ( cloudevent : functions . CloudEventsContext ) => {
271
- receivedCloudEvent = cloudevent as functions . CloudEventsContext ;
272
- } ,
273
- SignatureType . CLOUDEVENT
274
- ) ;
263
+ const server = getServer ( ( cloudevent : functions . CloudEventsContext ) => {
264
+ receivedCloudEvent = cloudevent as functions . CloudEventsContext ;
265
+ } , SignatureType . CLOUDEVENT ) ;
275
266
await supertest ( server )
276
267
. post ( '/' )
277
268
. set ( test . headers )
0 commit comments