Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit69de83c

Browse files
committed
fix: document return issue
1 parent226888d commit69de83c

File tree

8 files changed

+41
-17
lines changed

8 files changed

+41
-17
lines changed

‎test/groupher_server/cms/articles/blog_test.exs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmoduleGroupherServer.Test.Articles.Blogdo
22
useGroupherServer.TestTools
33

4-
aliasGroupherServer.CMS
4+
aliasGroupherServer.{CMS,Repo}
55
aliasHelper.Converter.{EditorToHTML,HtmlSanitizer}
66

77
aliasEditorToHTML.{Class,Validator}
@@ -22,18 +22,23 @@ defmodule GroupherServer.Test.Articles.Blog do
2222
end
2323

2424
describe"[cms blogs curd]"do
25+
@tag:wip
2526
test"can create blog with valid attrs",~m(user community blog_attrs)ado
2627
assert{:error,_}=ORM.find_by(Author,user_id:user.id)
2728
{:ok,blog}=CMS.create_article(community,:blog,blog_attrs,user)
29+
blog=Repo.preload(blog,:document)
2830

29-
body_map=Jason.decode!(blog.body)
31+
body_map=Jason.decode!(blog.document.body)
3032

3133
assertblog.meta.thread=="BLOG"
3234

3335
assertblog.title==blog_attrs.title
3436
assertbody_map|>Validator.is_valid()
35-
assertblog.body_html|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
36-
assertblog.body_html|>String.contains?(~s(<p id="block-))
37+
38+
assertblog.document.body_html
39+
|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
40+
41+
assertblog.document.body_html|>String.contains?(~s(<p id="block-))
3742

3843
paragraph_text=body_map["blocks"]|>List.first()|>get_in(["data","text"])
3944
assertblog.digest==paragraph_text|>HtmlSanitizer.strip_all_tags()

‎test/groupher_server/cms/articles/job_test.exs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmoduleGroupherServer.Test.Articles.Jobdo
22
useGroupherServer.TestTools
33

4-
aliasGroupherServer.CMS
4+
aliasGroupherServer.{CMS,Repo}
55
aliasHelper.Converter.{EditorToHTML,HtmlSanitizer}
66

77
aliasEditorToHTML.{Class,Validator}
@@ -23,18 +23,23 @@ defmodule GroupherServer.Test.Articles.Job do
2323
end
2424

2525
describe"[cms jobs curd]"do
26+
@tag:wip
2627
test"can create job with valid attrs",~m(user community job_attrs)ado
2728
assert{:error,_}=ORM.find_by(Author,user_id:user.id)
2829
{:ok,job}=CMS.create_article(community,:job,job_attrs,user)
30+
job=Repo.preload(job,:document)
2931

30-
body_map=Jason.decode!(job.body)
32+
body_map=Jason.decode!(job.document.body)
3133

3234
assertjob.meta.thread=="JOB"
3335

3436
assertjob.title==job_attrs.title
3537
assertbody_map|>Validator.is_valid()
36-
assertjob.body_html|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
37-
assertjob.body_html|>String.contains?(~s(<p id="block-))
38+
39+
assertjob.document.body_html
40+
|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
41+
42+
assertjob.document.body_html|>String.contains?(~s(<p id="block-))
3843

3944
paragraph_text=body_map["blocks"]|>List.first()|>get_in(["data","text"])
4045
assertjob.digest==paragraph_text|>HtmlSanitizer.strip_all_tags()

‎test/groupher_server/cms/articles/post_test.exs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule GroupherServer.Test.CMS.Articles.Post do
22
useGroupherServer.TestTools
33

44
aliasHelper.ORM
5-
aliasGroupherServer.CMS
5+
aliasGroupherServer.{CMS,Repo}
66
aliasHelper.Converter.{EditorToHTML,HtmlSanitizer}
77

88
aliasEditorToHTML.{Class,Validator}
@@ -23,18 +23,23 @@ defmodule GroupherServer.Test.CMS.Articles.Post do
2323
end
2424

2525
describe"[cms post curd]"do
26+
@tag:wip
2627
test"can create post with valid attrs",~m(user community post_attrs)ado
2728
assert{:error,_}=ORM.find_by(Author,user_id:user.id)
2829
{:ok,post}=CMS.create_article(community,:post,post_attrs,user)
30+
post=Repo.preload(post,:document)
2931

30-
body_map=Jason.decode!(post.body)
32+
body_map=Jason.decode!(post.document.body)
3133

3234
assertpost.meta.thread=="POST"
3335

3436
assertpost.title==post_attrs.title
3537
assertbody_map|>Validator.is_valid()
36-
assertpost.body_html|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
37-
assertpost.body_html|>String.contains?(~s(<p id="block-))
38+
39+
assertpost.document.body_html
40+
|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
41+
42+
assertpost.document.body_html|>String.contains?(~s(<p id="block-))
3843

3944
paragraph_text=body_map["blocks"]|>List.first()|>get_in(["data","text"])
4045
assertpost.digest==paragraph_text|>HtmlSanitizer.strip_all_tags()

‎test/groupher_server/cms/articles/repo_test.exs‎

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

44
aliasGroupherServer.CMS
5+
aliasGroupherServer.Repo,as:GlabelRepo
56
aliasHelper.Converter.{EditorToHTML}
67

78
aliasEditorToHTML.{Class,Validator}
@@ -23,17 +24,22 @@ defmodule GroupherServer.Test.Articles.Repo do
2324
end
2425

2526
describe"[cms repo curd]"do
27+
@tag:wip
2628
test"can create repo with valid attrs",~m(user community repo_attrs)ado
2729
assert{:error,_}=ORM.find_by(Author,user_id:user.id)
2830
{:ok,repo}=CMS.create_article(community,:repo,repo_attrs,user)
31+
repo=GlabelRepo.preload(repo,:document)
2932

30-
body_map=Jason.decode!(repo.body)
33+
body_map=Jason.decode!(repo.document.body)
3134

3235
assertrepo.meta.thread=="REPO"
3336

3437
assertrepo.title==repo_attrs.title
3538
assertbody_map|>Validator.is_valid()
36-
assertrepo.body_html|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
39+
40+
assertrepo.document.body_html
41+
|>String.contains?(~s(<div class="#{@root_class["viewer"]}">))
42+
3743
assertrepo.contributors|>length!==0
3844
end
3945

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ defmodule GroupherServer.Test.Mutation.Articles.Post do
155155
end
156156

157157
test"login user with auth passport delete a post",~m(post)ado
158+
post=post|>Repo.preload(:communities)
158159
post_communities_0=post.communities|>List.first()|>Map.get(:title)
159160
passport_rules=%{post_communities_0=>%{"post.delete"=>true}}
160161
rule_conn=simu_conn(:user,cms:passport_rules)

‎test/groupher_server_web/mutation/cms/publish_throttle_test.exs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ defmodule GroupherServer.Test.Mutation.PublishThrottle do
3535
communityId: $communityId
3636
) {
3737
title
38-
body
3938
id
4039
}
4140
}
@@ -49,6 +48,7 @@ defmodule GroupherServer.Test.Mutation.PublishThrottle do
4948
assertcreated|>Map.has_key?("id")
5049
end
5150

51+
@tag:wip
5252
test"user create 2 content with valid inverval time success",~m(community)ado
5353
{:ok,user}=db_insert(:user)
5454
user_conn=simu_conn(:user,user)
@@ -191,6 +191,7 @@ defmodule GroupherServer.Test.Mutation.PublishThrottle do
191191
|>mutation_get_error?(@create_post_query,variables,ecode(:throttle_day))
192192
end
193193

194+
@tag:wip
194195
test"user create multi content with valid day count success in next day",~m(community)ado
195196
{:ok,user}=db_insert(:user)
196197
user_conn=simu_conn(:user,user)

‎test/groupher_server_web/query/cms/articles/job_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule GroupherServer.Test.Query.Articles.Job do
2424

2525
assertresults["id"]==to_string(job.id)
2626
assertis_valid_kv?(results,"title",:string)
27-
assertlength(Map.keys(results))==3
27+
assertlength(Map.keys(results))==2
2828
end
2929

3030
test"basic graphql query on job with stranger(unloged user)",~m(guest_conn job)ado

‎test/groupher_server_web/query/cms/articles/post_test.exs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ defmodule GroupherServer.Test.Query.Articles.Post do
2727
}
2828
}
2929
"""
30+
@tag:wip
3031
test"basic graphql query on post with logined user",
3132
~m(user_conn community user post_attrs)ado
3233
{:ok,post}=CMS.create_article(community,:post,post_attrs,user)
@@ -37,7 +38,7 @@ defmodule GroupherServer.Test.Query.Articles.Post do
3738
assertresults["id"]==to_string(post.id)
3839
assertis_valid_kv?(results,"title",:string)
3940
assert%{"isEdited"=>false}==results["meta"]
40-
assertlength(Map.keys(results))==4
41+
assertlength(Map.keys(results))==3
4142
end
4243

4344
test"basic graphql query on post with stranger(unloged user)",~m(guest_conn post)ado

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp