@@ -236,6 +236,10 @@ describe('SAM utils', async function () {
236236 const value1 = 'myStackName'
237237 const value2 = 'myBucketName'
238238
239+ after ( async ( ) => {
240+ await globals . context . workspaceState . update ( mementoRootKey , { } )
241+ } )
242+
239243 it ( '1. getRecentResponse should return undefined when mementoRootKey does not exist' , async ( ) => {
240244 assert ( ! getRecentResponse ( nonExistingMementoRootKey , identifier , key1 ) )
241245 } )
@@ -244,7 +248,7 @@ describe('SAM utils', async function () {
244248 try {
245249 await updateRecentResponse ( mementoRootKey , identifier , key1 , value1 )
246250 } catch ( err ) {
247- assert . fail ( 'Should have succeed ' )
251+ assert . fail ( 'The execution should have succeeded yet encounter unexpected exception ' )
248252 }
249253 } )
250254
@@ -261,12 +265,12 @@ describe('SAM utils', async function () {
261265 assert . strictEqual ( result2 , value2 )
262266 } )
263267
264- it ( '5. updateRecentResponse should log when failed to update value' , async ( ) => {
268+ it ( '5. updateRecentResponse should log and swallow exception when fails to update value' , async ( ) => {
265269 sinon . stub ( globals . context . workspaceState , 'update' ) . rejects ( new Error ( 'Error updating value' ) )
266270 try {
267271 await updateRecentResponse ( mementoRootKey , identifier , key2 , value2 )
268272 } catch ( err ) {
269- assert . fail ( 'Should have swallowed exception' )
273+ assert . fail ( 'The target function should have handled exception internally ' )
270274 }
271275 assertLogsContain ( `sam: unable to save response at key` , false , 'warn' )
272276 sinon . restore ( )
0 commit comments