@@ -255,16 +255,25 @@ var _ = Describe("RemoveOp.Apply", func() {
255255 _ , err := RemoveOp {Path : MustNewPointerFromString ("/abc/efg" )}.Apply (doc )
256256 Expect (err ).To (HaveOccurred ())
257257 Expect (err .Error ()).To (Equal (
258- "Expected to find a map key 'abc' for path '/abc'" ))
258+ "Expected to find a map key 'abc' for path '/abc' (found map keys: 'xyz') " ))
259259 })
260260
261261 It ("returns an error if key does not exist" , func () {
262- doc := map [interface {}]interface {}{"xyz" : "xyz" }
262+ doc := map [interface {}]interface {}{"xyz" : "xyz" , 123 : "xyz" , "other-xyz" : "xyz" }
263+
264+ _ , err := RemoveOp {Path : MustNewPointerFromString ("/abc" )}.Apply (doc )
265+ Expect (err ).To (HaveOccurred ())
266+ Expect (err .Error ()).To (Equal (
267+ "Expected to find a map key 'abc' for path '/abc' (found map keys: 'other-xyz', 'xyz')" ))
268+ })
269+
270+ It ("returns an error without other found keys when there are no keys and key does not exist" , func () {
271+ doc := map [interface {}]interface {}{}
263272
264273 _ , err := RemoveOp {Path : MustNewPointerFromString ("/abc" )}.Apply (doc )
265274 Expect (err ).To (HaveOccurred ())
266275 Expect (err .Error ()).To (Equal (
267- "Expected to find a map key 'abc' for path '/abc'" ))
276+ "Expected to find a map key 'abc' for path '/abc' (found no other map keys) " ))
268277 })
269278
270279 It ("returns an error if it's not a map when key is being accessed" , func () {
0 commit comments