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.

Commit078cd34

Browse files
committed
fix: digest length test case
1 parent9c15667 commit078cd34

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

‎config/config.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ config :groupher_server, :article,
104104
:pill,
105105
:popcorn
106106
],
107-
digest_length:120,
107+
digest_length:150,
108108
archive_threshold:%{
109109
# for post, blog, job, works, radar, job
110110
default:[weeks:-1],

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
defmoduleGroupherServer.Test.CMS.Articles.Postdo
22
useGroupherServer.TestTools
33

4+
importHelper.Utils,only:[get_config:2]
5+
46
aliasHelper.ORM
57
aliasGroupherServer.{CMS,Repo}
68
aliasHelper.Converter.{EditorToHTML,HtmlSanitizer}
@@ -10,6 +12,7 @@ defmodule GroupherServer.Test.CMS.Articles.Post do
1012

1113
@root_classClass.article()
1214
@last_yearTimex.shift(Timex.beginning_of_year(Timex.now()),days:-3,seconds:-1)
15+
@article_digest_lengthget_config(:article,:digest_length)
1316

1417
setupdo
1518
{:ok,user}=db_insert(:user)
@@ -41,7 +44,11 @@ defmodule GroupherServer.Test.CMS.Articles.Post do
4144
assertpost.document.body_html|>String.contains?(~s(<p id="block-))
4245

4346
paragraph_text=body_map["blocks"]|>List.first()|>get_in(["data","text"])
44-
assertpost.digest==paragraph_text|>HtmlSanitizer.strip_all_tags()
47+
48+
assertpost.digest==
49+
paragraph_text
50+
|>HtmlSanitizer.strip_all_tags()
51+
|>String.slice(0,@article_digest_length)
4552
end
4653

4754
test"created post should have a acitve_at field, same with inserted_at",

‎test/groupher_server/seeds/clean_up_test.exs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ defmodule GroupherServer.Test.Seeds.CleanUp do
33
useGroupherServer.TestTools
44

55
# alias GroupherServer.Accounts.Model.User
6-
aliasGroupherServer.{CMS,Repo}
6+
aliasGroupherServer.CMS
77

8-
aliasCMS.Model.{Community,Thread,CommunityThread,ArticleTag,Post}
8+
aliasCMS.Model.{Thread,CommunityThread,ArticleTag,Post}
99
# alias CMS.Delegate.SeedsConfig
1010

1111
aliasHelper.ORM

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp