@@ -506,28 +506,33 @@ describe("Auth Controller", () => {
506506 } ) ;
507507 } ) ;
508508
509- it ( ' should trigger a login events the user is logged in' , async ( ) => {
509+ it ( " should trigger a login events the user is logged in" , async ( ) => {
510510 kuzzle . emit = sinon . stub ( ) ;
511511
512- await kuzzle . auth
513- . login ( "strategy" , credentials , "expiresIn" )
514- . then ( ( ) => {
515- should ( kuzzle . emit ) . be . calledWith ( "beforeLogin" ) ;
516- should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , { success : true } ) ;
517- should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , { success : true } ) ;
518- } ) ;
512+ await kuzzle . auth . login ( "strategy" , credentials , "expiresIn" ) . then ( ( ) => {
513+ should ( kuzzle . emit ) . be . calledWith ( "beforeLogin" ) ;
514+ should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , { success : true } ) ;
515+ should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , { success : true } ) ;
516+ } ) ;
519517 kuzzle . emit . reset ( ) ;
520518
521519 kuzzle . query . rejects ( ) ;
522- await kuzzle . auth . login ( "strategy" , credentials , "expiresIn" )
520+ await kuzzle . auth
521+ . login ( "strategy" , credentials , "expiresIn" )
523522 . catch ( ( ) => {
524523 should ( kuzzle . emit ) . be . calledWith ( "beforeLogin" ) ;
525- should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , { success : false , error : "Error" } ) ;
526- should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , { success : false , error : "Error" } ) ;
524+ should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , {
525+ success : false ,
526+ error : "Error" ,
527+ } ) ;
528+ should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , {
529+ success : false ,
530+ error : "Error" ,
531+ } ) ;
527532 } ) ;
528533 } ) ;
529534
530- it ( ' should trigger a login events the user is logged in with cookieAuthentication enabled' , async ( ) => {
535+ it ( " should trigger a login events the user is logged in with cookieAuthentication enabled" , async ( ) => {
531536 kuzzle . emit = sinon . stub ( ) ;
532537 kuzzle . cookieAuthentication = true ;
533538 kuzzle . query . resolves ( {
@@ -536,22 +541,26 @@ describe("Auth Controller", () => {
536541 } ,
537542 } ) ;
538543
539- await kuzzle . auth
540- . login ( "strategy" , credentials , "expiresIn" )
541- . then ( ( ) => {
542- should ( kuzzle . emit ) . be . calledWith ( "beforeLogin" ) ;
543- should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , { success : true } ) ;
544- should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , { success : true } ) ;
545- } ) ;
544+ await kuzzle . auth . login ( "strategy" , credentials , "expiresIn" ) . then ( ( ) => {
545+ should ( kuzzle . emit ) . be . calledWith ( "beforeLogin" ) ;
546+ should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , { success : true } ) ;
547+ should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , { success : true } ) ;
548+ } ) ;
546549 kuzzle . emit . reset ( ) ;
547550
548551 kuzzle . query . rejects ( ) ;
549552 await should ( kuzzle . auth . login ( "strategy" , credentials , "expiresIn" ) )
550553 . be . rejected ( )
551554 . catch ( ( ) => {
552555 should ( kuzzle . emit ) . be . calledWith ( "beforeLogin" ) ;
553- should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , { success : false , error : "Error" } ) ;
554- should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , { success : false , error : "Error" } ) ;
556+ should ( kuzzle . emit ) . be . calledWith ( "afterLogin" , {
557+ success : false ,
558+ error : "Error" ,
559+ } ) ;
560+ should ( kuzzle . emit ) . be . calledWith ( "loginAttempt" , {
561+ success : false ,
562+ error : "Error" ,
563+ } ) ;
555564 } ) ;
556565 } ) ;
557566
@@ -616,11 +625,14 @@ describe("Auth Controller", () => {
616625 // ? Fail logout
617626 kuzzle . query . rejects ( ) ;
618627 await kuzzle . auth . logout ( ) . catch ( ( ) => {
619- should ( kuzzle . emit ) . be . calledWith ( "logoutAttempt" , { success : false , error : "Error" } ) ;
628+ should ( kuzzle . emit ) . be . calledWith ( "logoutAttempt" , {
629+ success : false ,
630+ error : "Error" ,
631+ } ) ;
620632 } ) ;
621633 } ) ;
622634
623- it ( ' should trigger logout events when the user is logged out' , async ( ) => {
635+ it ( " should trigger logout events when the user is logged out" , async ( ) => {
624636 kuzzle . emit = sinon . stub ( ) ;
625637 await kuzzle . auth . logout ( ) . then ( ( ) => {
626638 should ( kuzzle . emit ) . be . calledWith ( "beforeLogout" ) ;
@@ -631,7 +643,10 @@ describe("Auth Controller", () => {
631643 // ? Fail logout
632644 kuzzle . query . rejects ( ) ;
633645 await kuzzle . auth . logout ( ) . catch ( ( ) => {
634- should ( kuzzle . emit ) . be . calledWith ( "afterLogout" , { success : false , error : "Error" } ) ;
646+ should ( kuzzle . emit ) . be . calledWith ( "afterLogout" , {
647+ success : false ,
648+ error : "Error" ,
649+ } ) ;
635650 } ) ;
636651 } ) ;
637652 } ) ;
0 commit comments