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

Commit 1b9cc8f

Browse files
committed
refactor(pinned-article): wip
1 parent aabff2f commit 1b9cc8f

File tree

8 files changed

+16
-18
lines changed

8 files changed

+16
-18
lines changed

test/groupher_server/cms/article_pin_test.exs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ defmodule GroupherServer.Test.CMS.ArticlePin do
3535
assert pind_article.post_id == post.id
3636
end
3737

38-
@tag :wip
38+
@tag :wip2
3939
test "one community & thread can only pin certern count of post", ~m(community post user)a do
40-
{:ok, _post2} = CMS.create_content(community, :post, mock_attrs(:post), user)
41-
{:ok, post3} = CMS.create_content(community, :post, mock_attrs(:post), user)
42-
4340
Enum.reduce(1..@max_pinned_article_count_per_thread, [], fn _, acc ->
44-
{:ok, _} = CMS.pin_article(:post, post.id, community.id)
41+
{:ok, new_post} = CMS.create_content(community, :post, mock_attrs(:post), user)
42+
{:ok, _} = CMS.pin_article(:post, new_post.id, community.id)
4543
acc
4644
end)
4745

48-
{:error, reason} = CMS.pin_article(:post, post3.id, community.id)
46+
{:ok, new_post} = CMS.create_content(community, :post, mock_attrs(:post), user)
47+
{:error, reason} = CMS.pin_article(:post, new_post.id, community.id)
4948
assert reason |> Keyword.get(:code) == ecode(:too_much_pinned_article)
5049
end
5150

@@ -54,12 +53,11 @@ defmodule GroupherServer.Test.CMS.ArticlePin do
5453
assert {:error, _} = CMS.pin_article(:post, 8848, community.id)
5554
end
5655

57-
@tag :wip
56+
@tag :wip2
5857
test "can undo pin to a post", ~m(community post)a do
5958
{:ok, _} = CMS.pin_article(:post, post.id, community.id)
6059

6160
assert {:ok, unpinned} = CMS.undo_pin_article(:post, post.id, community.id)
62-
assert unpinned.post_id == post.id
6361

6462
assert {:error, _} = ORM.find_by(PinnedArticle, %{post_id: post.id})
6563
end

test/groupher_server_web/mutation/cms/cms_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ defmodule GroupherServer.Test.Mutation.CMS.Basic do
216216
assert belong_community["id"] == to_string(community.id)
217217
end
218218

219-
# TODO: @tag :wip2
219+
# TODO: @tag :wip
220220
# test "auth user create duplicate tag fails", ~m(community)a do
221221
# variables = mock_attrs(:tag, %{communityId: community.id})
222222

test/groupher_server_web/mutation/cms/job_flag_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ defmodule GroupherServer.Test.Mutation.JobFlag do
112112
}
113113
}
114114
"""
115-
@tag :wip2
115+
@tag :wip
116116
test "auth user can undo pin job", ~m(community job)a do
117117
variables = %{id: job.id, communityId: community.id}
118118

test/groupher_server_web/mutation/cms/post_flag_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ defmodule GroupherServer.Test.Mutation.PostFlag do
8484
}
8585
}
8686
"""
87-
@tag :wip2
87+
@tag :wip
8888
test "auth user can pin post", ~m(community post)a do
8989
variables = %{id: post.id, communityId: community.id}
9090

@@ -113,7 +113,7 @@ defmodule GroupherServer.Test.Mutation.PostFlag do
113113
}
114114
}
115115
"""
116-
@tag :wip2
116+
@tag :wip
117117
test "auth user can undo pin post", ~m(community post)a do
118118
variables = %{id: post.id, communityId: community.id}
119119

test/groupher_server_web/mutation/cms/repo_flag_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ defmodule GroupherServer.Test.Mutation.RepoFlag do
112112
}
113113
}
114114
"""
115-
@tag :wip2
115+
@tag :wip
116116
test "auth user can undo pin repo", ~m(community repo)a do
117117
variables = %{id: repo.id, communityId: community.id}
118118

test/groupher_server_web/query/cms/jobs_flags_test.exs

Lines changed: 2 additions & 2 deletions
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 :wip
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}}
@@ -73,7 +73,7 @@ defmodule GroupherServer.Test.Query.JobsFlags do
7373
assert entries_first["isPinned"] == true
7474
end
7575

76-
@tag :wip2
76+
@tag :wip
7777
test "pind jobs should not appear when page > 1", ~m(guest_conn community)a do
7878
variables = %{filter: %{page: 2, size: 20}}
7979
results = guest_conn |> query_result(@query, variables, "pagedJobs")

test/groupher_server_web/query/cms/posts_flags_test.exs

Lines changed: 2 additions & 2 deletions
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 :wip
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}}
@@ -73,7 +73,7 @@ defmodule GroupherServer.Test.Query.PostsFlags do
7373
assert entries_first["isPinned"] == true
7474
end
7575

76-
@tag :wip2
76+
@tag :wip
7777
test "pind posts should not appear when page > 1", ~m(guest_conn community)a do
7878
variables = %{filter: %{page: 2, size: 20}}
7979
results = guest_conn |> query_result(@query, variables, "pagedPosts")

test/groupher_server_web/query/cms/repos_flags_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ defmodule GroupherServer.Test.Query.ReposFlags do
7171
assert entries_first["isPinned"] == true
7272
end
7373

74-
@tag :wip2
74+
@tag :wip
7575
test "pind repos should not appear when page > 1", ~m(guest_conn community)a do
7676
variables = %{filter: %{page: 2, size: 20}}
7777
results = guest_conn |> query_result(@query, variables, "pagedRepos")

0 commit comments

Comments
 (0)