@@ -284,7 +284,7 @@ describe("identity", () => {
284
284
describe ( "beforeOperation" , ( ) => {
285
285
it ( "should handle eventType and handler for before create events" , ( ) => {
286
286
const fn = identity . beforeOperation ( "beforeCreate" , ( ) => Promise . resolve ( ) , undefined ) ;
287
-
287
+
288
288
expect ( fn . __endpoint ) . to . deep . equal ( {
289
289
...MINIMAL_V2_ENDPOINT ,
290
290
platform : "gcfv2" ,
@@ -298,10 +298,10 @@ describe("identity", () => {
298
298
} ,
299
299
] ) ;
300
300
} ) ;
301
-
301
+
302
302
it ( "should handle eventType and handler for before sign in events" , ( ) => {
303
303
const fn = identity . beforeOperation ( "beforeSignIn" , ( ) => Promise . resolve ( ) , undefined ) ;
304
-
304
+
305
305
expect ( fn . __endpoint ) . to . deep . equal ( {
306
306
...MINIMAL_V2_ENDPOINT ,
307
307
platform : "gcfv2" ,
@@ -315,10 +315,10 @@ describe("identity", () => {
315
315
} ,
316
316
] ) ;
317
317
} ) ;
318
-
318
+
319
319
it ( "should handle eventType and handler for before email events" , ( ) => {
320
320
const fn = identity . beforeOperation ( "beforeSendEmail" , ( ) => Promise . resolve ( ) , undefined ) ;
321
-
321
+
322
322
expect ( fn . __endpoint ) . to . deep . equal ( {
323
323
...MINIMAL_V2_ENDPOINT ,
324
324
platform : "gcfv2" ,
@@ -332,10 +332,27 @@ describe("identity", () => {
332
332
} ,
333
333
] ) ;
334
334
} ) ;
335
-
335
+
336
+ it ( "should handle eventType and handler for before SMS events" , ( ) => {
337
+ const fn = identity . beforeOperation ( "beforeSendSms" , ( ) => Promise . resolve ( ) , undefined ) ;
338
+
339
+ expect ( fn . __endpoint ) . to . deep . equal ( {
340
+ ...MINIMAL_V2_ENDPOINT ,
341
+ platform : "gcfv2" ,
342
+ labels : { } ,
343
+ blockingTrigger : BEFORE_SMS_TRIGGER ,
344
+ } ) ;
345
+ expect ( fn . __requiredAPIs ) . to . deep . equal ( [
346
+ {
347
+ api : IDENTITY_TOOLKIT_API ,
348
+ reason : "Needed for auth blocking functions" ,
349
+ } ,
350
+ ] ) ;
351
+ } ) ;
352
+
336
353
it ( "should handle eventType, options, and handler for before create events" , ( ) => {
337
354
const fn = identity . beforeOperation ( "beforeCreate" , opts , ( ) => Promise . resolve ( ) ) ;
338
-
355
+
339
356
expect ( fn . __endpoint ) . to . deep . equal ( {
340
357
...MINIMAL_V2_ENDPOINT ,
341
358
platform : "gcfv2" ,
@@ -357,10 +374,10 @@ describe("identity", () => {
357
374
} ,
358
375
] ) ;
359
376
} ) ;
360
-
377
+
361
378
it ( "should handle eventType, options, and handler for before sign in events" , ( ) => {
362
379
const fn = identity . beforeOperation ( "beforeSignIn" , opts , ( ) => Promise . resolve ( ) ) ;
363
-
380
+
364
381
expect ( fn . __endpoint ) . to . deep . equal ( {
365
382
...MINIMAL_V2_ENDPOINT ,
366
383
platform : "gcfv2" ,
@@ -382,10 +399,10 @@ describe("identity", () => {
382
399
} ,
383
400
] ) ;
384
401
} ) ;
385
-
402
+
386
403
it ( "should handle eventType, options, and handler for before send email events" , ( ) => {
387
404
const fn = identity . beforeOperation ( "beforeSendEmail" , opts , ( ) => Promise . resolve ( ) ) ;
388
-
405
+
389
406
expect ( fn . __endpoint ) . to . deep . equal ( {
390
407
...MINIMAL_V2_ENDPOINT ,
391
408
platform : "gcfv2" ,
@@ -403,7 +420,28 @@ describe("identity", () => {
403
420
} ,
404
421
] ) ;
405
422
} ) ;
406
- } ) ;
423
+
424
+ it ( "should handle eventType, options, and handler for before send SMS events" , ( ) => {
425
+ const fn = identity . beforeOperation ( "beforeSendSms" , opts , ( ) => Promise . resolve ( ) ) ;
426
+
427
+ expect ( fn . __endpoint ) . to . deep . equal ( {
428
+ ...MINIMAL_V2_ENDPOINT ,
429
+ platform : "gcfv2" ,
430
+ labels : { } ,
431
+ minInstances : 1 ,
432
+ region : [ REGION ] ,
433
+ blockingTrigger : {
434
+ ...BEFORE_SMS_TRIGGER ,
435
+ } ,
436
+ } ) ;
437
+ expect ( fn . __requiredAPIs ) . to . deep . equal ( [
438
+ {
439
+ api : IDENTITY_TOOLKIT_API ,
440
+ reason : "Needed for auth blocking functions" ,
441
+ } ,
442
+ ] ) ;
443
+ } ) ;
444
+ } ) ;
407
445
408
446
describe ( "getOpts" , ( ) => {
409
447
it ( "should parse an empty object" , ( ) => {
0 commit comments