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

Commit 8c5d89a

Browse files
committed
refactor(article-tags): fix tests
1 parent 9edb5eb commit 8c5d89a

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

lib/groupher_server/cms/delegates/article_curd.ex

+3-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
7070

7171
with {:ok, info} <- match(thread) do
7272
info.model
73-
# TODO: trash -> mark_delete
7473
|> domain_filter_query(filter)
7574
|> QueryBuilder.filter_pack(Map.merge(filter, %{mark_delete: false}))
7675
|> ORM.paginater(~m(page size)a)
@@ -311,7 +310,9 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
311310
defp add_pin_articles_ifneed(articles, _querable, _filter), do: articles
312311

313312
# if filter contains like: tags, sort.., then don't add pin article
314-
defp should_add_pin?(%{page: 1, tag: :all, sort: :desc_inserted} = _filter) do
313+
# TODO: tag
314+
# defp should_add_pin?(%{page: 1, article_tag: :all, sort: :desc_inserted} = _filter) do
315+
defp should_add_pin?(%{page: 1, sort: :desc_inserted} = _filter) do
315316
{:ok, :pass}
316317
end
317318

test/groupher_server_web/mutation/cms/articles/job_test.exs

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Job do
3232
$scale: String!,
3333
$field: String!,
3434
$mentionUsers: [Ids],
35-
$tags: [Ids]
35+
$articleTags: [Ids]
3636
) {
3737
createJob(
3838
title: $title,
@@ -49,7 +49,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Job do
4949
scale: $scale,
5050
field: $field,
5151
mentionUsers: $mentionUsers,
52-
tags: $tags
52+
articleTags: $articleTags
5353
) {
5454
id
5555
title
@@ -136,8 +136,8 @@ defmodule GroupherServer.Test.Mutation.Articles.Job do
136136
end
137137

138138
@query """
139-
mutation($id: ID!, $title: String, $body: String, $salary: String, $tags: [Ids]){
140-
updateJob(id: $id, title: $title, body: $body, salary: $salary, tags: $tags) {
139+
mutation($id: ID!, $title: String, $body: String, $salary: String, $articleTags: [Ids]){
140+
updateJob(id: $id, title: $title, body: $body, salary: $salary, articleTags: $articleTags) {
141141
id
142142
title
143143
body

test/groupher_server_web/mutation/cms/articles/post_test.exs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Post do
2323
$digest: String!
2424
$length: Int!
2525
$communityId: ID!
26-
$tags: [Ids]
26+
$articleTags: [Ids]
2727
$mentionUsers: [Ids]
2828
) {
2929
createPost(
@@ -32,7 +32,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Post do
3232
digest: $digest
3333
length: $length
3434
communityId: $communityId
35-
tags: $tags
35+
articleTags: $articleTags
3636
mentionUsers: $mentionUsers
3737
) {
3838
title
@@ -164,8 +164,8 @@ defmodule GroupherServer.Test.Mutation.Articles.Post do
164164
end
165165

166166
@query """
167-
mutation($id: ID!, $title: String, $body: String, $copyRight: String, $tags: [Ids]){
168-
updatePost(id: $id, title: $title, body: $body, copyRight: $copyRight, tags: $tags) {
167+
mutation($id: ID!, $title: String, $body: String, $copyRight: String, $articleTags: [Ids]){
168+
updatePost(id: $id, title: $title, body: $body, copyRight: $copyRight, articleTags: $articleTags) {
169169
id
170170
title
171171
body

test/groupher_server_web/mutation/cms/articles/repo_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Repo do
3434
$primaryLanguage: RepoLangInput,
3535
$contributors: [RepoContributorInput],
3636
$communityId: ID!,
37-
$tags: [Ids]
37+
$articleTags: [Ids]
3838
) {
3939
createRepo(
4040
title: $title,
@@ -54,7 +54,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Repo do
5454
releaseTag: $releaseTag,
5555
contributors: $contributors,
5656
communityId: $communityId,
57-
tags: $tags
57+
articleTags: $articleTags
5858
) {
5959
id
6060
title

test/groupher_server_web/mutation/statistics/statistics_test.exs

+7-6
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,23 @@ defmodule GroupherServer.Test.Mutation.Statistics do
2323
$digest: String!
2424
$length: Int!
2525
$communityId: ID!
26-
$tags: [Ids]
26+
$articleTags: [Ids]
2727
) {
2828
createPost(
2929
title: $title
3030
body: $body
3131
digest: $digest
3232
length: $length
3333
communityId: $communityId
34-
tags: $tags
34+
articleTags: $articleTags
3535
) {
3636
title
3737
body
3838
id
3939
}
4040
}
4141
"""
42+
@tag :wip2
4243
test "user should have contribute list after create a post", ~m(user_conn user community)a do
4344
post_attr = mock_attrs(:post)
4445
variables = post_attr |> Map.merge(%{communityId: community.id})
@@ -75,7 +76,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
7576
$finance: String!,
7677
$scale: String!,
7778
$field: String!,
78-
$tags: [Ids]
79+
$articleTags: [Ids]
7980
) {
8081
createJob(
8182
title: $title,
@@ -91,7 +92,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
9192
finance: $finance,
9293
scale: $scale,
9394
field: $field,
94-
tags: $tags
95+
articleTags: $articleTags
9596
) {
9697
id
9798
title
@@ -136,7 +137,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
136137
$primaryLanguage: RepoLangInput,
137138
$contributors: [RepoContributorInput],
138139
$communityId: ID!,
139-
$tags: [Ids]
140+
$articleTags: [Ids]
140141
) {
141142
createRepo(
142143
title: $title,
@@ -156,7 +157,7 @@ defmodule GroupherServer.Test.Mutation.Statistics do
156157
releaseTag: $releaseTag,
157158
contributors: $contributors,
158159
communityId: $communityId,
159-
tags: $tags
160+
articleTags: $articleTags
160161
) {
161162
id
162163
title

test/groupher_server_web/query/cms/cms_test.exs

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ defmodule GroupherServer.Test.Query.CMS.Basic do
6666
assert results["threadsCount"] == 5
6767
end
6868

69-
@tag :wip2
7069
test "can get tags count ", ~m(community guest_conn user)a do
7170
article_tag_attrs = mock_attrs(:article_tag)
7271
{:ok, article_tag} = CMS.create_article_tag(community, :post, article_tag_attrs, user)

test/groupher_server_web/query/cms/flags/posts_flags_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ defmodule GroupherServer.Test.Query.Flags.PostsFlags do
4848
}
4949
}
5050
"""
51-
51+
@tag :wip
5252
test "if have pinned posts, the pinned posts should at the top of entries",
5353
~m(guest_conn community post_m)a do
5454
variables = %{filter: %{community: community.raw}}

0 commit comments

Comments
 (0)