@@ -54,7 +54,15 @@ defmodule RemoveTest do
5454 }
5555
5656 remove_patch = % Remove { path: "/nameX" }
57- assert { :error , :invalid_path , "nameX" } = Jsonpatch . apply_patch ( remove_patch , target )
57+ assert { :error , :invalid_path , "nameX" } = Operation . apply_op ( remove_patch , target )
58+ end
59+
60+ test "Remove element in map with atom keys" do
61+ target = % { name: "Ceasar" , age: 66 }
62+
63+ remove_patch = % Remove { path: "/age" }
64+
65+ assert % { name: "Ceasar" } = Operation . apply_op ( remove_patch , target , keys: :atoms )
5866 end
5967
6068 test "Remove element by invalid index" do
@@ -66,7 +74,7 @@ defmodule RemoveTest do
6674 }
6775
6876 remove_patch = % Remove { path: "/hobbies/a" }
69- assert { :error , :invalid_index , "a" } = Jsonpatch . apply_patch ( remove_patch , target )
77+ assert { :error , :invalid_index , "a" } = Operation . apply_op ( remove_patch , target )
7078
7179 # Longer path
7280 target = % {
@@ -77,11 +85,11 @@ defmodule RemoveTest do
7785 }
7886
7987 remove_patch = % Remove { path: "/hobbies/b/description" }
80- assert { :error , :invalid_index , "b" } = Jsonpatch . apply_patch ( remove_patch , target )
88+ assert { :error , :invalid_index , "b" } = Operation . apply_op ( remove_patch , target )
8189
8290 # Longer path, numeric - out of
8391 remove_patch = % Remove { path: "/hobbies/1/description" }
84- assert { :error , :invalid_index , "1" } = Jsonpatch . apply_patch ( remove_patch , target )
92+ assert { :error , :invalid_index , "1" } = Operation . apply_op ( remove_patch , target )
8593 end
8694
8795 test "Return error when patch error was provided to remove operation" do
0 commit comments