File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ export class AccountsClient {
144
144
} else {
145
145
this . clearTokens ( ) ;
146
146
this . clearUser ( ) ;
147
+ throw new AccountsError ( 'no tokens provided' ) ;
147
148
}
148
149
}
149
150
Original file line number Diff line number Diff line change @@ -336,9 +336,13 @@ describe('Accounts', () => {
336
336
Accounts . config ( { } , { } ) ;
337
337
Accounts . instance . clearTokens = jest . fn ( ( ) => Accounts . instance . clearTokens ) ;
338
338
Accounts . instance . clearUser = jest . fn ( ( ) => Accounts . instance . clearUser ) ;
339
- await Accounts . refreshSession ( ) ;
340
- expect ( Accounts . instance . clearTokens . mock . calls . length ) . toEqual ( 1 ) ;
341
- expect ( Accounts . instance . clearUser . mock . calls . length ) . toEqual ( 1 ) ;
339
+ try {
340
+ await Accounts . refreshSession ( ) ;
341
+ } catch ( err ) {
342
+ expect ( err . message ) . toEqual ( 'no tokens provided' ) ;
343
+ expect ( Accounts . instance . clearTokens . mock . calls . length ) . toEqual ( 1 ) ;
344
+ expect ( Accounts . instance . clearUser . mock . calls . length ) . toEqual ( 1 ) ;
345
+ }
342
346
} ) ;
343
347
it ( 'clears tokens, users and throws error if bad refresh token provided' , async ( ) => {
344
348
Accounts . config ( { } , { } ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export default {
21
21
profilePath : '/' ,
22
22
changePasswordPath : null ,
23
23
homePath : '/' ,
24
+ signOutPath : '/' ,
24
25
// TODO enable all of these
25
26
// onSubmitHook: () => {},
26
27
// onPreSignUpHook: () => new Promise(resolve => resolve()),
@@ -29,6 +30,6 @@ export default {
29
30
onResetPasswordHook : ( ) => redirect ( AccountsClient . options ( ) . loginPath ) ,
30
31
onVerifyEmailHook : ( ) => redirect ( AccountsClient . options ( ) . profilePath ) ,
31
32
onSignedInHook : ( ) => redirect ( AccountsClient . options ( ) . homePath ) ,
32
- onSignedOutHook : ( ) => redirect ( AccountsClient . options ( ) . homePath ) ,
33
+ onSignedOutHook : ( ) => redirect ( AccountsClient . options ( ) . signOutPath ) ,
33
34
loginOnSignUp : true ,
34
35
} ;
You can’t perform that action at this time.
0 commit comments