This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
lib/groupher_server_web/resolvers Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ defmodule GroupherServerWeb.Resolvers.CMS do
1313 alias Helper.ORM
1414 alias Helper.Utils
1515
16+ @ default_article_meta CMS.Delegate.ArticleOperation . default_article_meta ( )
17+
1618 # #######################
1719 # community ..
1820 # #######################
@@ -449,11 +451,14 @@ defmodule GroupherServerWeb.Resolvers.CMS do
449451 %{"exampleKey" => false } -> %{example_key: false }
450452 """
451453 def get_article_meta ( root , _ , _ ) do
452- meta_info =
453- root . meta
454+ # if meta is nil , means exsit article or test env (like: db_insert)
455+ meta = if is_nil ( root . meta ) , do: @ default_article_meta , else: root . meta
456+
457+ fmt_meta =
458+ meta
454459 |> Utils . snake_map_key ( )
455460 |> Utils . keys_to_atoms ( )
456461
457- { :ok , meta_info }
462+ { :ok , fmt_meta }
458463 end
459464end
Original file line number Diff line number Diff line change @@ -170,7 +170,6 @@ defmodule GroupherServer.Test.Mutation.Job do
170170 }
171171 }
172172 """
173- @ tag :wip2
174173 test "update a job without login user fails" , ~m( guest_conn job) a do
175174 unique_num = System . unique_integer ( [ :positive , :monotonic ] )
176175
@@ -219,7 +218,6 @@ defmodule GroupherServer.Test.Mutation.Job do
219218 assert updated [ "tags" ] |> Enum . any? ( & ( & 1 [ "id" ] == to_string ( tag . id ) ) )
220219 end
221220
222- @ tag :wip2
223221 test "update job tags will replace old city-tags" , ~m( owner_conn user job) a do
224222 unique_num = System . unique_integer ( [ :positive , :monotonic ] )
225223
Original file line number Diff line number Diff line change @@ -268,7 +268,6 @@ defmodule GroupherServer.Test.Mutation.Post do
268268 assert updated_post [ "copyRight" ] == variables . copyRight
269269 end
270270
271- @ tag :wip2
272271 test "update post with valid attrs should have isEdited meta info update" ,
273272 ~m( owner_conn post) a do
274273 unique_num = System . unique_integer ( [ :positive , :monotonic ] )
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ defmodule GroupherServer.Test.Query.Post do
4343 assert length ( Map . keys ( results ) ) == 4
4444 end
4545
46+ @ tag :wip2
4647 test "basic graphql query on post with stranger(unloged user)" , ~m( guest_conn post) a do
4748 variables = % { id: post . id }
4849 results = guest_conn |> query_result ( @ query , variables , "post" )
You can’t perform that action at this time.
0 commit comments