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

Commit 21c92c9

Browse files
committed
refactor(article-emotions): fix broken test
1 parent a4f6557 commit 21c92c9

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

lib/groupher_server/cms/delegates/helper.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ defmodule GroupherServer.CMS.Delegate.Helper do
2828
%User{} = user,
2929
type \\ :article
3030
) do
31+
IO.inspect("hello?")
3132
supported_emotions = get_supported_mentions(type)
3233

3334
new_entries =

lib/groupher_server_web/middleware/pagesize_proof.ex

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ defmodule GroupherServerWeb.Middleware.PageSizeProof do
4545

4646
def call(resolution, _) do
4747
case valid_size(resolution.arguments) do
48-
{:error, msg} ->
49-
resolution |> handle_absinthe_error(msg, ecode(:pagination))
50-
51-
arguments ->
52-
%{resolution | arguments: sort_desc_by_default(arguments)}
48+
{:error, msg} -> resolution |> handle_absinthe_error(msg, ecode(:pagination))
49+
arguments -> %{resolution | arguments: sort_desc_by_default(arguments)}
5350
end
5451
end
5552

lib/groupher_server_web/resolvers/cms_resolver.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ defmodule GroupherServerWeb.Resolvers.CMS do
5555
end
5656

5757
def paged_articles(_root, ~m(thread filter)a, %{context: %{cur_user: user}}) do
58+
IO.inspect(filter, label: "the filter")
5859
CMS.paged_articles(thread, filter, user)
5960
end
6061

test/groupher_server_web/mutation/accounts/customization_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ defmodule GroupherServer.Test.Mutation.Account.Customization do
7272
}
7373
}
7474
"""
75-
@tag :wip3
75+
@tag :wip2
7676
test "PageSizeProof middleware should lint c11n displayDensity size", ~m(user)a do
7777
user_conn = simu_conn(:user, user)
7878
db_insert_multi(:post, 50)

test/groupher_server_web/query/cms/jobs_flags_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule GroupherServer.Test.Query.JobsFlags do
5151
}
5252
}
5353
"""
54-
@tag :wip2
54+
@tag :wip3
5555
test "if have pined jobs, the pined jobs should at the top of entries",
5656
~m(guest_conn community job_m)a do
5757
variables = %{filter: %{community: community.raw}}

test/groupher_server_web/query/cms/posts_flags_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule GroupherServer.Test.Query.PostsFlags do
5151
}
5252
}
5353
"""
54-
@tag :wip2
54+
@tag :wip3
5555
test "if have pined posts, the pined posts should at the top of entries",
5656
~m(guest_conn community post_m)a do
5757
variables = %{filter: %{community: community.raw}}

test/groupher_server_web/query/cms/repos_flags_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ defmodule GroupherServer.Test.Query.ReposFlags do
5050
}
5151
}
5252
"""
53-
@tag :wip2
53+
@tag :wip3
5454
test "if have pined repos, the pined repos should at the top of entries",
5555
~m(guest_conn community repo_m)a do
5656
variables = %{filter: %{community: community.raw}}

test/support/factory.ex

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ defmodule GroupherServer.Support.Factory do
1010
alias GroupherServer.Repo
1111
alias GroupherServer.{Accounts, CMS, Delivery}
1212

13+
@default_emotions CMS.Embeds.ArticleCommentEmotion.default_emotions()
14+
1315
defp mock_meta(:post) do
1416
body = Faker.Lorem.sentence(%Range{first: 80, last: 120})
1517

@@ -23,7 +25,8 @@ defmodule GroupherServer.Support.Factory do
2325
communities: [
2426
mock(:community),
2527
mock(:community)
26-
]
28+
],
29+
emotions: @default_emotions
2730
}
2831
end
2932

@@ -58,7 +61,8 @@ defmodule GroupherServer.Support.Factory do
5861
communities: [
5962
mock(:community),
6063
mock(:community)
61-
]
64+
],
65+
emotions: @default_emotions
6266
}
6367
end
6468

@@ -121,7 +125,8 @@ defmodule GroupherServer.Support.Factory do
121125
scale: scale_enum |> Enum.at(Enum.random(0..(length(scale_enum) - 1))),
122126
communities: [
123127
mock(:community)
124-
]
128+
],
129+
emotions: @default_emotions
125130
}
126131
end
127132

0 commit comments

Comments
 (0)