Skip to content

Commit 5f77c8b

Browse files
committed
add missing tests
1 parent 6b4e59d commit 5f77c8b

File tree

1 file changed

+50
-12
lines changed

1 file changed

+50
-12
lines changed

spec/v2/providers/identity.spec.ts

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ describe("identity", () => {
284284
describe("beforeOperation", () => {
285285
it("should handle eventType and handler for before create events", () => {
286286
const fn = identity.beforeOperation("beforeCreate", () => Promise.resolve(), undefined);
287-
287+
288288
expect(fn.__endpoint).to.deep.equal({
289289
...MINIMAL_V2_ENDPOINT,
290290
platform: "gcfv2",
@@ -298,10 +298,10 @@ describe("identity", () => {
298298
},
299299
]);
300300
});
301-
301+
302302
it("should handle eventType and handler for before sign in events", () => {
303303
const fn = identity.beforeOperation("beforeSignIn", () => Promise.resolve(), undefined);
304-
304+
305305
expect(fn.__endpoint).to.deep.equal({
306306
...MINIMAL_V2_ENDPOINT,
307307
platform: "gcfv2",
@@ -315,10 +315,10 @@ describe("identity", () => {
315315
},
316316
]);
317317
});
318-
318+
319319
it("should handle eventType and handler for before email events", () => {
320320
const fn = identity.beforeOperation("beforeSendEmail", () => Promise.resolve(), undefined);
321-
321+
322322
expect(fn.__endpoint).to.deep.equal({
323323
...MINIMAL_V2_ENDPOINT,
324324
platform: "gcfv2",
@@ -332,10 +332,27 @@ describe("identity", () => {
332332
},
333333
]);
334334
});
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+
336353
it("should handle eventType, options, and handler for before create events", () => {
337354
const fn = identity.beforeOperation("beforeCreate", opts, () => Promise.resolve());
338-
355+
339356
expect(fn.__endpoint).to.deep.equal({
340357
...MINIMAL_V2_ENDPOINT,
341358
platform: "gcfv2",
@@ -357,10 +374,10 @@ describe("identity", () => {
357374
},
358375
]);
359376
});
360-
377+
361378
it("should handle eventType, options, and handler for before sign in events", () => {
362379
const fn = identity.beforeOperation("beforeSignIn", opts, () => Promise.resolve());
363-
380+
364381
expect(fn.__endpoint).to.deep.equal({
365382
...MINIMAL_V2_ENDPOINT,
366383
platform: "gcfv2",
@@ -382,10 +399,10 @@ describe("identity", () => {
382399
},
383400
]);
384401
});
385-
402+
386403
it("should handle eventType, options, and handler for before send email events", () => {
387404
const fn = identity.beforeOperation("beforeSendEmail", opts, () => Promise.resolve());
388-
405+
389406
expect(fn.__endpoint).to.deep.equal({
390407
...MINIMAL_V2_ENDPOINT,
391408
platform: "gcfv2",
@@ -403,7 +420,28 @@ describe("identity", () => {
403420
},
404421
]);
405422
});
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+
});
407445

408446
describe("getOpts", () => {
409447
it("should parse an empty object", () => {

0 commit comments

Comments
 (0)