@@ -156,6 +156,35 @@ describe("UniqueValuesTest", function () {
156156 assert . strictEqual ( readValue . value , "Karmel" ) ;
157157 } ) ;
158158
159+ it ( "tryingToDeleteNonExistingKeyShouldNotThrow" , async ( ) => {
160+ const res1 = await store . operations . send (
161+ new PutCompareExchangeValueOperation < string > ( "key/1" , "Name" , 0 ) ) ;
162+
163+ assert . strictEqual ( res1 . value , "Name" ) ;
164+ assert . ok ( res1 . successful ) ;
165+
166+ const res2 = await store . operations . send (
167+ new DeleteCompareExchangeValueOperation < string > ( "key/2" , res1 . index ) ) ;
168+
169+ assert . ok ( res2 . successful ) ;
170+ assert . equal ( res2 . value , null ) ;
171+ assert . equal ( res2 . index , res1 . index + 1 ) ;
172+
173+ const res3 = await store . operations . send (
174+ new DeleteCompareExchangeValueOperation < string > ( "key/2" , 0 ) ) ;
175+
176+ assert . ok ( res3 . successful ) ;
177+ assert . equal ( res3 . value , null ) ;
178+ assert . equal ( res3 . index , res2 . index + 1 ) ;
179+
180+ const res4 = await store . operations . send (
181+ new DeleteCompareExchangeValueOperation < string > ( "key/2" , 999 ) ) ;
182+
183+ assert . ok ( res4 . successful ) ;
184+ assert . equal ( res4 . value , null ) ;
185+ assert . equal ( res4 . index , res3 . index + 1 ) ;
186+ } ) ;
187+
159188 it ( "returnCurrentValueWhenPuttingConcurrently" , async ( ) => {
160189 const user = new User ( ) ;
161190 user . name = "Karmel" ;
0 commit comments