@@ -585,21 +585,15 @@ describe('calls the NoIdentityAvailable event', () => {
585585 uid2 . init ( {
586586 identity : expiredIdentity ,
587587 } ) ;
588- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
589- identity : expiredIdentity ,
590- } ) ;
588+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
591589 } ) ;
592590 test ( 'when init is already complete but the existing identity is expired' , ( ) => {
593591 uid2 . init ( {
594592 identity : expiredIdentity ,
595593 } ) ;
596- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
597- identity : null ,
598- } ) ;
594+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
599595 uid2 . init ( { } ) ;
600- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
601- identity : expiredIdentity ,
602- } ) ;
596+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
603597 } ) ;
604598 test ( 'when identity is expired but refreshable' , ( ) => {
605599 let expiredRefreshableIdentity = makeIdentity ( {
@@ -609,52 +603,40 @@ describe('calls the NoIdentityAvailable event', () => {
609603 uid2 . init ( { identity : expiredRefreshableIdentity } ) ;
610604
611605 // in this case, identity is temporarily unavailable but still unavailable
612- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
613- identity : null ,
614- } ) ;
606+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
615607 } ) ;
616608 test ( 'when login is required' , ( ) => {
617609 uid2 . isLoginRequired ( ) ;
618610
619- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
620- identity : null ,
621- } ) ;
611+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
622612 } ) ;
623613 test ( 'when get identity returns null or get advertising token returns undefined' , ( ) => {
624614 const nullIdentity = uid2 . getIdentity ( ) ;
625615
626616 expect ( nullIdentity ) . toBeNull ( ) ;
627- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
628- identity : null ,
629- } ) ;
617+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
630618 } ) ;
631619 test ( 'when there is no advertising token' , ( ) => {
632620 const token = uid2 . getAdvertisingToken ( ) ;
633621
634622 expect ( token ) . toBeUndefined ( ) ;
635- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
636- identity : null ,
637- } ) ;
623+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
638624 } ) ;
639625 test ( 'when cstg does not succeed' , ( ) => {
640626 uid2 . init ( { } ) ;
641627 expect ( uid2 . setIdentityFromEmail ( 'a' , mocks . makeUid2CstgOption ( ) ) ) . rejects . toThrow (
642628 'Invalid email address'
643629 ) ;
644630
645- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
646- identity : null ,
647- } ) ;
631+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
648632 } ) ;
649633 test ( 'when an identity was valid but has since expired' , ( ) => {
650634 uid2 . init ( { } ) ;
651635 expect ( uid2 . setIdentityFromEmail ( 'a' , mocks . makeUid2CstgOption ( ) ) ) . rejects . toThrow (
652636 'Invalid email address'
653637 ) ;
654638
655- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
656- identity : null ,
657- } ) ;
639+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
658640 } ) ;
659641 test ( 'when identity was valid on init but has since expired' , ( ) => {
660642 const refreshFrom = Date . now ( ) + 100 ;
@@ -672,9 +654,7 @@ describe('calls the NoIdentityAvailable event', () => {
672654
673655 uid2 . isIdentityAvailable ( ) ;
674656
675- expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
676- identity : originalIdentity ,
677- } ) ;
657+ expect ( handler ) . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
678658 } ) ;
679659} ) ;
680660
@@ -690,27 +670,19 @@ describe('does not call NoIdentityAvailable event', () => {
690670 uid2 . init ( { } ) ;
691671 handler = jest . fn ( ) ;
692672 uid2 . setIdentity ( validIdentity ) ;
693- expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
694- identity : null ,
695- } ) ;
673+ expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
696674
697675 uid2 . getIdentity ( ) ;
698- expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
699- identity : null ,
700- } ) ;
676+ expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
701677
702678 uid2 . getAdvertisingToken ( ) ;
703- expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
704- identity : null ,
705- } ) ;
679+ expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
706680 } ) ;
707681 test ( 'when identity is set with opted out identity' , ( ) => {
708682 uid2 . init ( { } ) ;
709683 let optedOutIdentity = makeIdentity ( { status : 'optout' } ) ;
710684 uid2 . setIdentity ( optedOutIdentity ) ;
711- expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
712- identity : null ,
713- } ) ;
685+ expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
714686 } ) ;
715687 test ( 'when cstg is successful' , async ( ) => {
716688 uid2 . init ( { } ) ;
@@ -719,16 +691,12 @@ describe('does not call NoIdentityAvailable event', () => {
719691 await uid2 . setIdentityFromEmail ( '[email protected] ' , mocks . makeUid2CstgOption ( ) ) ; 720692 } ) . not . toThrow ( ) ;
721693
722- expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
723- identity : null ,
724- } ) ;
694+ expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
725695 } ) ;
726696 test ( 'when identity is set with local storage and init has never been' , ( ) => {
727697 mocks . setUid2LocalStorage ( validIdentity ) ;
728698 uid2 . isIdentityAvailable ( ) ;
729699
730- expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , {
731- identity : null ,
732- } ) ;
700+ expect ( handler ) . not . toHaveBeenLastCalledWith ( EventType . NoIdentityAvailable , { identity : null } ) ;
733701 } ) ;
734702} ) ;
0 commit comments