@@ -26,6 +26,9 @@ import { onInit } from "../../../src/v2/core";
26
26
import { MockRequest } from "../../fixtures/mockrequest" ;
27
27
import { runHandler } from "../../helper" ;
28
28
29
+ const IDENTITY_TOOLKIT_API = "identitytoolkit.googleapis.com" ;
30
+ const REGION = "us-west1" ;
31
+
29
32
const BEFORE_CREATE_TRIGGER = {
30
33
eventType : "providers/cloud.auth/eventTypes/user.beforeCreate" ,
31
34
options : {
@@ -46,18 +49,14 @@ const BEFORE_SIGN_IN_TRIGGER = {
46
49
47
50
const BEFORE_EMAIL_TRIGGER = {
48
51
eventType : "providers/cloud.auth/eventTypes/user.beforeSendEmail" ,
49
- options : {
50
- accessToken : false ,
51
- idToken : false ,
52
- refreshToken : false ,
53
- } ,
52
+ options : { } ,
54
53
} ;
55
54
56
55
const opts : identity . BlockingOptions = {
57
56
accessToken : true ,
58
57
refreshToken : false ,
59
58
minInstances : 1 ,
60
- region : "us-west1" ,
59
+ region : REGION ,
61
60
} ;
62
61
63
62
describe ( "identity" , ( ) => {
@@ -73,7 +72,7 @@ describe("identity", () => {
73
72
} ) ;
74
73
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
75
74
{
76
- api : "identitytoolkit.googleapis.com" ,
75
+ api : IDENTITY_TOOLKIT_API ,
77
76
reason : "Needed for auth blocking functions" ,
78
77
} ,
79
78
] ) ;
@@ -87,7 +86,7 @@ describe("identity", () => {
87
86
platform : "gcfv2" ,
88
87
labels : { } ,
89
88
minInstances : 1 ,
90
- region : [ "us-west1" ] ,
89
+ region : [ REGION ] ,
91
90
blockingTrigger : {
92
91
...BEFORE_CREATE_TRIGGER ,
93
92
options : {
@@ -98,7 +97,7 @@ describe("identity", () => {
98
97
} ) ;
99
98
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
100
99
{
101
- api : "identitytoolkit.googleapis.com" ,
100
+ api : IDENTITY_TOOLKIT_API ,
102
101
reason : "Needed for auth blocking functions" ,
103
102
} ,
104
103
] ) ;
@@ -138,7 +137,7 @@ describe("identity", () => {
138
137
} ) ;
139
138
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
140
139
{
141
- api : "identitytoolkit.googleapis.com" ,
140
+ api : IDENTITY_TOOLKIT_API ,
142
141
reason : "Needed for auth blocking functions" ,
143
142
} ,
144
143
] ) ;
@@ -152,7 +151,7 @@ describe("identity", () => {
152
151
platform : "gcfv2" ,
153
152
labels : { } ,
154
153
minInstances : 1 ,
155
- region : [ "us-west1" ] ,
154
+ region : [ REGION ] ,
156
155
blockingTrigger : {
157
156
...BEFORE_SIGN_IN_TRIGGER ,
158
157
options : {
@@ -163,7 +162,7 @@ describe("identity", () => {
163
162
} ) ;
164
163
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
165
164
{
166
- api : "identitytoolkit.googleapis.com" ,
165
+ api : IDENTITY_TOOLKIT_API ,
167
166
reason : "Needed for auth blocking functions" ,
168
167
} ,
169
168
] ) ;
@@ -203,7 +202,7 @@ describe("identity", () => {
203
202
} ) ;
204
203
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
205
204
{
206
- api : "identitytoolkit.googleapis.com" ,
205
+ api : IDENTITY_TOOLKIT_API ,
207
206
reason : "Needed for auth blocking functions" ,
208
207
} ,
209
208
] ) ;
@@ -218,7 +217,7 @@ describe("identity", () => {
218
217
platform : "gcfv2" ,
219
218
labels : { } ,
220
219
minInstances : 1 ,
221
- region : [ "us-west1" ] ,
220
+ region : [ REGION ] ,
222
221
blockingTrigger : {
223
222
...BEFORE_EMAIL_TRIGGER ,
224
223
options : {
@@ -229,7 +228,7 @@ describe("identity", () => {
229
228
} ) ;
230
229
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
231
230
{
232
- api : "identitytoolkit.googleapis.com" ,
231
+ api : IDENTITY_TOOLKIT_API ,
233
232
reason : "Needed for auth blocking functions" ,
234
233
} ,
235
234
] ) ;
@@ -247,7 +246,7 @@ describe("identity", () => {
247
246
} ) ;
248
247
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
249
248
{
250
- api : "identitytoolkit.googleapis.com" ,
249
+ api : IDENTITY_TOOLKIT_API ,
251
250
reason : "Needed for auth blocking functions" ,
252
251
} ,
253
252
] ) ;
@@ -264,7 +263,7 @@ describe("identity", () => {
264
263
} ) ;
265
264
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
266
265
{
267
- api : "identitytoolkit.googleapis.com" ,
266
+ api : IDENTITY_TOOLKIT_API ,
268
267
reason : "Needed for auth blocking functions" ,
269
268
} ,
270
269
] ) ;
@@ -281,7 +280,7 @@ describe("identity", () => {
281
280
} ) ;
282
281
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
283
282
{
284
- api : "identitytoolkit.googleapis.com" ,
283
+ api : IDENTITY_TOOLKIT_API ,
285
284
reason : "Needed for auth blocking functions" ,
286
285
} ,
287
286
] ) ;
@@ -295,7 +294,7 @@ describe("identity", () => {
295
294
platform : "gcfv2" ,
296
295
labels : { } ,
297
296
minInstances : 1 ,
298
- region : [ "us-west1" ] ,
297
+ region : [ REGION ] ,
299
298
blockingTrigger : {
300
299
...BEFORE_CREATE_TRIGGER ,
301
300
options : {
@@ -306,7 +305,7 @@ describe("identity", () => {
306
305
} ) ;
307
306
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
308
307
{
309
- api : "identitytoolkit.googleapis.com" ,
308
+ api : IDENTITY_TOOLKIT_API ,
310
309
reason : "Needed for auth blocking functions" ,
311
310
} ,
312
311
] ) ;
@@ -320,7 +319,7 @@ describe("identity", () => {
320
319
platform : "gcfv2" ,
321
320
labels : { } ,
322
321
minInstances : 1 ,
323
- region : [ "us-west1" ] ,
322
+ region : [ REGION ] ,
324
323
blockingTrigger : {
325
324
...BEFORE_SIGN_IN_TRIGGER ,
326
325
options : {
@@ -331,7 +330,7 @@ describe("identity", () => {
331
330
} ) ;
332
331
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
333
332
{
334
- api : "identitytoolkit.googleapis.com" ,
333
+ api : IDENTITY_TOOLKIT_API ,
335
334
reason : "Needed for auth blocking functions" ,
336
335
} ,
337
336
] ) ;
@@ -345,7 +344,7 @@ describe("identity", () => {
345
344
platform : "gcfv2" ,
346
345
labels : { } ,
347
346
minInstances : 1 ,
348
- region : [ "us-west1" ] ,
347
+ region : [ REGION ] ,
349
348
blockingTrigger : {
350
349
...BEFORE_EMAIL_TRIGGER ,
351
350
options : {
@@ -356,7 +355,7 @@ describe("identity", () => {
356
355
} ) ;
357
356
expect ( fn . __requiredAPIs ) . to . deep . equal ( [
358
357
{
359
- api : "identitytoolkit.googleapis.com" ,
358
+ api : IDENTITY_TOOLKIT_API ,
360
359
reason : "Needed for auth blocking functions" ,
361
360
} ,
362
361
] ) ;
0 commit comments