Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 52e13bc

Browse files
committed
refactor(delivery): fix test
1 parent 60bef5a commit 52e13bc

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

test/groupher_server/cms/hooks/notify_post_test.exs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyPost do
3535
notify = notifications.entries |> List.first()
3636
assert notify.action == "UPVOTE"
3737
assert notify.article_id == post.id
38-
assert notify.type == "POST"
38+
assert notify.thread == "POST"
3939
assert notify.user_id == post.author.user.id
4040
assert user_exist_in?(user2, notify.from_users)
4141
end
4242

43-
@tag :wip
43+
@tag :wip2
4444
test "upvote hook should work on post comment", ~m(user2 post comment)a do
4545
{:ok, comment} = CMS.upvote_comment(comment.id, user2)
4646
{:ok, comment} = preload_author(comment)
@@ -55,7 +55,7 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyPost do
5555
notify = notifications.entries |> List.first()
5656
assert notify.action == "UPVOTE"
5757
assert notify.article_id == post.id
58-
assert notify.type == "POST"
58+
assert notify.thread == "POST"
5959
assert notify.user_id == comment.author.id
6060
assert notify.comment_id == comment.id
6161
assert user_exist_in?(user2, notify.from_users)
@@ -111,7 +111,7 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyPost do
111111
notify = notifications.entries |> List.first()
112112
assert notify.action == "COLLECT"
113113
assert notify.article_id == post.id
114-
assert notify.type == "POST"
114+
assert notify.thread == "POST"
115115
assert notify.user_id == post.author.user.id
116116
assert user_exist_in?(user2, notify.from_users)
117117
end
@@ -148,12 +148,10 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyPost do
148148

149149
notify = notifications.entries |> List.first()
150150
assert notify.action == "COMMENT"
151-
assert notify.type == "POST"
151+
assert notify.thread == "POST"
152152
assert notify.article_id == post.id
153153
assert notify.user_id == post.author.user.id
154154
assert user_exist_in?(user2, notify.from_users)
155-
156-
IO.inspect(notifications, label: "notifications")
157155
end
158156
end
159157
end

test/groupher_server/delivery/notification_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defmodule GroupherServer.Test.Delivery.Notification do
1717
{:ok, community} = db_insert(:community)
1818

1919
notify_attrs = %{
20-
type: :post,
20+
thread: :post,
2121
article_id: post.id,
2222
title: post.title,
2323
action: :upvote,
@@ -55,6 +55,7 @@ defmodule GroupherServer.Test.Delivery.Notification do
5555
assert user3 |> user_exist_in?(notify.from_users)
5656
end
5757

58+
@tag :wip
5859
test "different notify should not be merged", ~m(user user2 user3 notify_attrs)a do
5960
{:ok, _} = Delivery.send(:notify, notify_attrs, user2)
6061
notify_attrs = notify_attrs |> Map.put(:action, :collect)

0 commit comments

Comments
 (0)