File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ const browserWindow = {
3131 loadURL : jest . fn ( ) ,
3232 webContents : {
3333 on : ( ) => { } ,
34+ session : {
35+ clearStorageData : jest . fn ( ) ,
36+ } ,
3437 } ,
3538 on : ( ) => { } ,
3639 close : jest . fn ( ) ,
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ describe('utils/helpers.ts', () => {
105105
106106 authGithub ( undefined , dispatch ) ;
107107
108+ expect (
109+ new BrowserWindow ( ) . webContents . session . clearStorageData
110+ ) . toHaveBeenCalledTimes ( 1 ) ;
111+
108112 expect ( new BrowserWindow ( ) . loadURL ) . toHaveBeenCalledTimes ( 1 ) ;
109113 expect ( new BrowserWindow ( ) . loadURL ) . toHaveBeenCalledWith (
110114 'https://github.com/login/oauth/authorize?client_id=3fef4433a29c6ad8f22c&scope=user:email,notifications'
@@ -127,6 +131,10 @@ describe('utils/helpers.ts', () => {
127131 }
128132 ) ;
129133
134+ expect (
135+ new BrowserWindow ( ) . webContents . session . clearStorageData
136+ ) . toHaveBeenCalledTimes ( 1 ) ;
137+
130138 // @ts -ignore
131139 new BrowserWindow ( ) . loadURL . mockReset ( ) ;
132140
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ export function authGithub(
5353 const githubUrl = `https://${ authOptions . hostname } /login/oauth/authorize` ;
5454 const authUrl = `${ githubUrl } ?client_id=${ authOptions . clientId } &scope=${ Constants . AUTH_SCOPE } ` ;
5555
56+ const session = authWindow . webContents . session ;
57+ session . clearStorageData ( ) ;
58+
5659 authWindow . loadURL ( authUrl ) ;
5760
5861 function handleCallback ( url ) {
You can’t perform that action at this time.
0 commit comments