File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
packages/amazonq/test/unit/codewhisperer/util Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,34 @@ describe('AuthUtil', async function () {
140140 } )
141141 } )
142142
143+ describe ( 'cacheChangedHandler' , function ( ) {
144+ it ( 'calls logout when event is delete' , async function ( ) {
145+ const logoutSpy = sinon . spy ( auth , 'logout' )
146+
147+ await ( auth as any ) . cacheChangedHandler ( 'delete' )
148+
149+ assert . ok ( logoutSpy . calledOnce )
150+ } )
151+
152+ it ( 'calls restore when event is create' , async function ( ) {
153+ const restoreSpy = sinon . spy ( auth , 'restore' )
154+
155+ await ( auth as any ) . cacheChangedHandler ( 'create' )
156+
157+ assert . ok ( restoreSpy . calledOnce )
158+ } )
159+
160+ it ( 'does nothing for other events' , async function ( ) {
161+ const logoutSpy = sinon . spy ( auth , 'logout' )
162+ const restoreSpy = sinon . spy ( auth , 'restore' )
163+
164+ await ( auth as any ) . cacheChangedHandler ( 'unknown' )
165+
166+ assert . ok ( logoutSpy . notCalled )
167+ assert . ok ( restoreSpy . notCalled )
168+ } )
169+ } )
170+
143171 describe ( 'stateChangeHandler' , function ( ) {
144172 let mockLspAuth : any
145173 let regionProfileManager : any
You can’t perform that action at this time.
0 commit comments