aboutsummaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_utils_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivant.business@gmail.com>2019-04-02 09:19:10 +0300
committerIvan Tashkinov <ivant.business@gmail.com>2019-04-02 09:19:10 +0300
commitaac48d0cc6893c231c88d5cd7fe0334353bbf299 (patch)
treec3e423993ff5289dd0ba73a94881bd52d9cda1c2 /test/web/common_api/common_api_utils_test.exs
parentf6fab01ba7a08fe0e5147f82d9e3dd294922dc93 (diff)
parentf8aa917eef9280631a5cd2c95cf1db8fab6e14e5 (diff)
downloadpleroma-aac48d0cc6893c231c88d5cd7fe0334353bbf299.tar.gz
Merge remote-tracking branch 'remotes/upstream/develop' into features/mastoapi/2.6.0-conversations
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r--test/web/common_api/common_api_utils_test.exs17
1 files changed, 17 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..e04b9f9b5 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -4,6 +4,7 @@
defmodule Pleroma.Web.CommonAPI.UtilsTest do
alias Pleroma.Builders.UserBuilder
+ alias Pleroma.Object
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.Endpoint
use Pleroma.DataCase
@@ -136,4 +137,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