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

Commit b5afe82

Browse files
committed
refactor(dir): statistics model wip
1 parent b71ecb0 commit b5afe82

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/groupher_server_web/mutation/statistics/statistics_test.exs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
22
use GroupherServer.TestTools
33

44
alias GroupherServer.Statistics
5+
alias Statistics.Model.{CommunityContribute, UserContribute}
56
# alias GroupherServer.Accounts.Model.User
67
alias Helper.ORM
78

@@ -45,7 +46,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
4546

4647
user_conn |> mutation_result(@create_post_query, variables, "createPost")
4748

48-
{:ok, contributes} = ORM.find_by(Statistics.UserContribute, user_id: user.id)
49+
{:ok, contributes} = ORM.find_by(UserContribute, user_id: user.id)
4950
assert contributes.count == 1
5051
end
5152

@@ -56,7 +57,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
5657

5758
user_conn |> mutation_result(@create_post_query, variables, "createPost")
5859

59-
{:ok, contributes} = ORM.find_by(Statistics.CommunityContribute, community_id: community.id)
60+
{:ok, contributes} = ORM.find_by(CommunityContribute, community_id: community.id)
6061
assert contributes.count == 1
6162
end
6263

@@ -95,7 +96,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
9596

9697
user_conn |> mutation_result(@create_job_query, variables, "createJob")
9798

98-
{:ok, contributes} = ORM.find_by(Statistics.UserContribute, user_id: user.id)
99+
{:ok, contributes} = ORM.find_by(UserContribute, user_id: user.id)
99100
assert contributes.count == 1
100101
end
101102

@@ -152,7 +153,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
152153

153154
user_conn |> mutation_result(@create_repo_query, variables, "createRepo")
154155

155-
{:ok, contributes} = ORM.find_by(Statistics.UserContribute, user_id: user.id)
156+
{:ok, contributes} = ORM.find_by(UserContribute, user_id: user.id)
156157
assert contributes.count == 1
157158
end
158159

@@ -170,7 +171,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
170171
variables = %{community: community.raw, thread: "POST", id: post.id, body: "this a comment"}
171172
user_conn |> mutation_result(@create_comment_query, variables, "createComment")
172173

173-
{:ok, contributes} = ORM.find_by(Statistics.UserContribute, user_id: user.id)
174+
{:ok, contributes} = ORM.find_by(UserContribute, user_id: user.id)
174175
assert contributes.count == 1
175176
end
176177
end
@@ -187,9 +188,9 @@ defmodule GroupherServer.Test.Mutation.Statistics do
187188
test "for guest user makeContribute should add record to user_contribute table",
188189
~m(guest_conn user)a do
189190
variables = %{userId: user.id}
190-
assert {:error, _} = ORM.find_by(Statistics.UserContribute, user_id: user.id)
191+
assert {:error, _} = ORM.find_by(UserContribute, user_id: user.id)
191192
results = guest_conn |> mutation_result(@query, variables, "makeContrubute")
192-
assert {:ok, _} = ORM.find_by(Statistics.UserContribute, user_id: user.id)
193+
assert {:ok, _} = ORM.find_by(UserContribute, user_id: user.id)
193194

194195
assert ["count", "date"] == results |> Map.keys()
195196
assert results["date"] == Timex.today() |> Date.to_iso8601()

0 commit comments

Comments
 (0)