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

Commit 1bf1976

Browse files
committed
refactor(mailbox): fix tests
1 parent c85886f commit 1bf1976

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

test/groupher_server/cms/hooks/notify_blog_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyBlog do
33

44
import GroupherServer.CMS.Delegate.Helper, only: [preload_author: 1]
55

6-
alias GroupherServer.{CMS, Delivery}
6+
alias GroupherServer.{CMS, Delivery, Repo}
77
alias CMS.Delegate.Hooks
88

99
setup do
@@ -149,8 +149,8 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyBlog do
149149

150150
Hooks.Notify.handle(:reply, replyed_comment, user3)
151151

152-
{:ok, notifications} =
153-
Delivery.fetch(:notification, comment.author_id, %{page: 1, size: 20})
152+
comment = Repo.preload(comment, :author)
153+
{:ok, notifications} = Delivery.fetch(:notification, comment.author, %{page: 1, size: 20})
154154

155155
assert notifications.total_count == 1
156156

test/groupher_server/cms/hooks/notify_job_test.exs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyJob do
33

44
import GroupherServer.CMS.Delegate.Helper, only: [preload_author: 1]
55

6-
alias GroupherServer.{CMS, Delivery}
6+
alias GroupherServer.{CMS, Delivery, Repo}
77
alias CMS.Delegate.Hooks
88

99
setup do
@@ -81,7 +81,6 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyJob do
8181
Hooks.Notify.handle(:undo, :upvote, comment, user2)
8282

8383
{:ok, comment} = preload_author(comment)
84-
8584
{:ok, notifications} = Delivery.fetch(:notification, comment.author, %{page: 1, size: 20})
8685

8786
assert notifications.total_count == 0
@@ -149,8 +148,8 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyJob do
149148

150149
Hooks.Notify.handle(:reply, replyed_comment, user3)
151150

152-
{:ok, notifications} =
153-
Delivery.fetch(:notification, comment.author_id, %{page: 1, size: 20})
151+
comment = Repo.preload(comment, :author)
152+
{:ok, notifications} = Delivery.fetch(:notification, comment.author, %{page: 1, size: 20})
154153

155154
assert notifications.total_count == 1
156155

test/groupher_server/cms/hooks/notify_post_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyPost do
33

44
import GroupherServer.CMS.Delegate.Helper, only: [preload_author: 1]
55

6-
alias GroupherServer.{CMS, Delivery}
6+
alias GroupherServer.{CMS, Delivery, Repo}
77
alias CMS.Delegate.Hooks
88

99
setup do
@@ -149,8 +149,8 @@ defmodule GroupherServer.Test.CMS.Hooks.NotifyPost do
149149

150150
Hooks.Notify.handle(:reply, replyed_comment, user3)
151151

152-
{:ok, notifications} =
153-
Delivery.fetch(:notification, comment.author_id, %{page: 1, size: 20})
152+
comment = Repo.preload(comment, :author)
153+
{:ok, notifications} = Delivery.fetch(:notification, comment.author, %{page: 1, size: 20})
154154

155155
assert notifications.total_count == 1
156156

0 commit comments

Comments
 (0)