aboutsummaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_utils_test.exs
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-03-21 23:17:53 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2019-03-21 23:24:04 +0000
commitfea36967999fed5399ab3533e806e4cbc990ad05 (patch)
treea1b363a63bf62e9342313026238a8fffd509845e /test/web/common_api/common_api_utils_test.exs
parentbf8b29e080a6a8a369abb53a26229bb0544de1c0 (diff)
downloadpleroma-fea36967999fed5399ab3533e806e4cbc990ad05.tar.gz
common api: move context functions from twitterapi
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r--test/web/common_api/common_api_utils_test.exs16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
index 4c97b0d62..d095762ab 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -136,4 +136,20 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
assert output == expected
end
end
+
+ describe "context_to_conversation_id" do
+ test "creates a mapping object" do
+ conversation_id = Utils.context_to_conversation_id("random context")
+ object = Object.get_by_ap_id("random context")
+
+ assert conversation_id == object.id
+ end
+
+ test "returns an existing mapping for an existing object" do
+ {:ok, object} = Object.context_mapping("random context") |> Repo.insert()
+ conversation_id = Utils.context_to_conversation_id("random context")
+
+ assert conversation_id == object.id
+ end
+ end
end