summaryrefslogtreecommitdiff
path: root/test/safe_jsonb_set_test.exs
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2019-11-05 02:12:48 +0300
committerMaxim Filippov <colixer@gmail.com>2019-11-05 02:12:48 +0300
commit43ea16870fe60578a6528e1f01bfaab68943a1bc (patch)
tree108e2d85abfa60cea3b85cd07e0b2ab467b39668 /test/safe_jsonb_set_test.exs
parent24eecc3cb4a35376124b1fc792183d8b8dd0a9cc (diff)
parentfee127696308dbec9cff6b2a9b399cf2877cf445 (diff)
downloadpleroma-43ea16870fe60578a6528e1f01bfaab68943a1bc.tar.gz
pleroma-43ea16870fe60578a6528e1f01bfaab68943a1bc.zip
Merge branch 'develop' into feature/reports-groups-and-multiple-state-update
Diffstat (limited to 'test/safe_jsonb_set_test.exs')
-rw-r--r--test/safe_jsonb_set_test.exs12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/safe_jsonb_set_test.exs b/test/safe_jsonb_set_test.exs
new file mode 100644
index 000000000..748540570
--- /dev/null
+++ b/test/safe_jsonb_set_test.exs
@@ -0,0 +1,12 @@
+defmodule Pleroma.SafeJsonbSetTest do
+ use Pleroma.DataCase
+
+ test "it doesn't wipe the object when asked to set the value to NULL" do
+ assert %{rows: [[%{"key" => "value", "test" => nil}]]} =
+ Ecto.Adapters.SQL.query!(
+ Pleroma.Repo,
+ "select safe_jsonb_set('{\"key\": \"value\"}'::jsonb, '{test}', NULL);",
+ []
+ )
+ end
+end