@@ -536,10 +536,13 @@ describe("onCall", () => {
536
536
describe ( "authPolicy" , ( ) => {
537
537
function req ( data : any , auth ?: Record < string , string > ) : any {
538
538
const headers = {
539
- "content-type" : "application/json"
539
+ "content-type" : "application/json" ,
540
540
} ;
541
541
if ( auth ) {
542
- headers [ "authorization" ] = `bearer ignored.${ Buffer . from ( JSON . stringify ( auth ) , "utf-8" ) . toString ( "base64" ) } .ignored` ;
542
+ headers [ "authorization" ] = `bearer ignored.${ Buffer . from (
543
+ JSON . stringify ( auth ) ,
544
+ "utf-8"
545
+ ) . toString ( "base64" ) } .ignored`;
543
546
}
544
547
const ret = new MockRequest ( { data } , headers ) ;
545
548
ret . method = "POST" ;
@@ -552,7 +555,7 @@ describe("onCall", () => {
552
555
553
556
after ( ( ) => {
554
557
sinon . restore ( ) ;
555
- } )
558
+ } ) ;
556
559
557
560
it ( "should check isSignedIn" , async ( ) => {
558
561
const func = https . onCall (
@@ -561,7 +564,7 @@ describe("onCall", () => {
561
564
} ,
562
565
( ) => 42
563
566
) ;
564
-
567
+
565
568
const authResp = await runHandler ( func , req ( null , { sub : "inlined" } ) ) ;
566
569
expect ( authResp . status ) . to . equal ( 200 ) ;
567
570
@@ -574,24 +577,24 @@ describe("onCall", () => {
574
577
{
575
578
authPolicy : https . hasClaim ( "meaning" ) ,
576
579
} ,
577
- ( ) => "HHGTTG" ,
580
+ ( ) => "HHGTTG"
578
581
) ;
579
582
const specificValue = https . onCall (
580
583
{
581
584
authPolicy : https . hasClaim ( "meaning" , "42" ) ,
582
585
} ,
583
- ( ) => "HHGTG" ,
584
- )
585
-
586
- const cases : Array < { fn : Handler , auth : null | Record < string , string > , status : number } > = [
587
- { fn : anyValue , auth : { meaning : "42" } , status : 200 } ,
588
- { fn : anyValue , auth : { meaning : "43" } , status : 200 } ,
589
- { fn : anyValue , auth : { order : "66" } , status : 403 } ,
590
- { fn : anyValue , auth : null , status : 403 } ,
591
- { fn : specificValue , auth : { meaning : "42" } , status : 200 } ,
592
- { fn : specificValue , auth : { meaning : "43" } , status : 403 } ,
593
- { fn : specificValue , auth : { order : "66" , } , status : 403 } ,
594
- { fn : specificValue , auth : null , status : 403 } ,
586
+ ( ) => "HHGTG"
587
+ ) ;
588
+
589
+ const cases : Array < { fn : Handler ; auth : null | Record < string , string > ; status : number } > = [
590
+ { fn : anyValue , auth : { meaning : "42" } , status : 200 } ,
591
+ { fn : anyValue , auth : { meaning : "43" } , status : 200 } ,
592
+ { fn : anyValue , auth : { order : "66" } , status : 403 } ,
593
+ { fn : anyValue , auth : null , status : 403 } ,
594
+ { fn : specificValue , auth : { meaning : "42" } , status : 200 } ,
595
+ { fn : specificValue , auth : { meaning : "43" } , status : 403 } ,
596
+ { fn : specificValue , auth : { order : "66" } , status : 403 } ,
597
+ { fn : specificValue , auth : null , status : 403 } ,
595
598
] ;
596
599
for ( const test of cases ) {
597
600
const resp = await runHandler ( test . fn , req ( null , test . auth ) ) ;
0 commit comments