File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
packages/clerk-js/src/core/__tests__ Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -535,6 +535,32 @@ describe('Clerk singleton', () => {
535
535
expect ( mockSession . touch ) . toHaveBeenCalled ( ) ;
536
536
} ) ;
537
537
538
+ it ( 'does not call __unstable__onBeforeSetActive before session.touch' , async ( ) => {
539
+ mockSession . touch . mockReturnValueOnce ( Promise . resolve ( ) ) ;
540
+ mockClientFetch . mockReturnValue ( Promise . resolve ( { signedInSessions : [ mockSession ] } ) ) ;
541
+
542
+ const onBeforeSetActive = jest . fn ( ) ;
543
+ ( window as any ) . __unstable__onBeforeSetActive = onBeforeSetActive ;
544
+
545
+ const sut = new Clerk ( productionPublishableKey ) ;
546
+ await sut . load ( ) ;
547
+ await sut . setActive ( { session : mockSession as any as ActiveSessionResource } ) ;
548
+ expect ( onBeforeSetActive ) . not . toHaveBeenCalled ( ) ;
549
+ } ) ;
550
+
551
+ it ( 'does not call __unstable__onAfterSetActive after session.touch' , async ( ) => {
552
+ mockSession . touch . mockReturnValueOnce ( Promise . resolve ( ) ) ;
553
+ mockClientFetch . mockReturnValue ( Promise . resolve ( { signedInSessions : [ mockSession ] } ) ) ;
554
+
555
+ const onAfterSetActive = jest . fn ( ) ;
556
+ ( window as any ) . __unstable__onAfterSetActive = onAfterSetActive ;
557
+
558
+ const sut = new Clerk ( productionPublishableKey ) ;
559
+ await sut . load ( ) ;
560
+ await sut . setActive ( { session : mockSession as any as ActiveSessionResource } ) ;
561
+ expect ( onAfterSetActive ) . not . toHaveBeenCalled ( ) ;
562
+ } ) ;
563
+
538
564
it ( 'navigate to `taskUrl` option' , async ( ) => {
539
565
mockSession . touch . mockReturnValue ( Promise . resolve ( ) ) ;
540
566
mockClientFetch . mockReturnValue ( Promise . resolve ( { signedInSessions : [ mockSession ] } ) ) ;
You can’t perform that action at this time.
0 commit comments