@@ -31,9 +31,9 @@ defmodule GroupherServer.Test.CMS.Hooks.CiteBlog do
3131 test "cited multi blog should work" , ~m( user community blog2 blog3 blog4 blog5 blog_attrs) a do
3232 body =
3333 mock_rich_text (
34- ~s( the <a href=#{ @ site_host } /blog/#{ blog2 . id } /> and <a href=#{ @ site_host } /blog/#{ blog2 . id } >same la</a> is awesome, the <a href= #{
35- @ site_host
36- } /blog/#{ blog3 . id } ></a> is awesome too.) ,
34+ ~s( the <a href=#{ @ site_host } /blog/#{ blog2 . id } /> and <a href=#{ @ site_host } /blog/#{
35+ blog2 . id
36+ } >same la</a> is awesome, the <a href= #{ @ site_host } /blog/#{ blog3 . id } ></a> is awesome too.) ,
3737 # second paragraph
3838 ~s( the paragraph 2 <a href=#{ @ site_host } /blog/#{ blog2 . id } class=#{ blog2 . title } > again</a>, the paragraph 2 <a href=#{
3939 @ site_host
@@ -90,7 +90,7 @@ defmodule GroupherServer.Test.CMS.Hooks.CiteBlog do
9090 assert cited_comment . meta . citing_count == 0
9191 end
9292
93- @ tag :wip
93+ @ tag :wip2
9494 test "can cite blog's comment in blog" , ~m( community user blog blog2 blog_attrs) a do
9595 { :ok , comment } = CMS . create_comment ( :blog , blog . id , mock_rich_text ( "hello" ) , user )
9696
@@ -136,9 +136,9 @@ defmodule GroupherServer.Test.CMS.Hooks.CiteBlog do
136136 test "can cited blog inside a comment" , ~m( user blog blog2 blog3 blog4 blog5) a do
137137 comment_body =
138138 mock_rich_text (
139- ~s( the <a href=#{ @ site_host } /blog/#{ blog2 . id } /> and <a href=#{ @ site_host } /blog/#{ blog2 . id } >same la</a> is awesome, the <a href= #{
140- @ site_host
141- } /blog/#{ blog3 . id } ></a> is awesome too.) ,
139+ ~s( the <a href=#{ @ site_host } /blog/#{ blog2 . id } /> and <a href=#{ @ site_host } /blog/#{
140+ blog2 . id
141+ } >same la</a> is awesome, the <a href= #{ @ site_host } /blog/#{ blog3 . id } ></a> is awesome too.) ,
142142 # second paragraph
143143 ~s( the paragraph 2 <a href=#{ @ site_host } /blog/#{ blog2 . id } class=#{ blog2 . title } > again</a>, the paragraph 2 <a href=#{
144144 @ site_host
@@ -221,60 +221,4 @@ defmodule GroupherServer.Test.CMS.Hooks.CiteBlog do
221221 assert result . total_count == 3
222222 end
223223 end
224-
225- describe "[cross cite]" do
226- test "can citing multi type thread and comment in one time" , ~m( user community blog2) a do
227- blog_attrs = mock_attrs ( :blog , % { community_id: community . id } )
228- blog_attrs = mock_attrs ( :blog , % { community_id: community . id } )
229- blog_attrs = mock_attrs ( :blog , % { community_id: community . id } )
230-
231- body = mock_rich_text ( ~s( the <a href=#{ @ site_host } /blog/#{ blog2 . id } />) )
232-
233- { :ok , blog } = CMS . create_article ( community , :blog , Map . merge ( blog_attrs , % { body: body } ) , user )
234-
235- Hooks.Cite . handle ( blog )
236-
237- Process . sleep ( 1000 )
238-
239- { :ok , blog } = CMS . create_article ( community , :blog , Map . merge ( blog_attrs , % { body: body } ) , user )
240- Hooks.Cite . handle ( blog )
241-
242- Process . sleep ( 1000 )
243-
244- comment_body = mock_comment ( ~s( the <a href=#{ @ site_host } /blog/#{ blog2 . id } />) )
245- { :ok , comment } = CMS . create_comment ( :blog , blog . id , comment_body , user )
246-
247- Hooks.Cite . handle ( comment )
248-
249- Process . sleep ( 1000 )
250-
251- { :ok , blog } =
252- CMS . create_article ( community , :blog , Map . merge ( blog_attrs , % { body: body } ) , user )
253-
254- Hooks.Cite . handle ( blog )
255-
256- { :ok , result } = CMS . paged_citing_contents ( "BLOG" , blog2 . id , % { page: 1 , size: 10 } )
257- # IO.inspect(result, label: "the result")
258-
259- assert result . total_count == 4
260-
261- result_blog = result . entries |> List . first ( )
262- result_blog = result . entries |> Enum . at ( 1 )
263- result_comment = result . entries |> Enum . at ( 2 )
264- result_blog = result . entries |> List . last ( )
265-
266- assert result_blog . id == blog . id
267- assert result_blog . thread == :blog
268-
269- assert result_blog . id == blog . id
270- assert result_blog . thread == :blog
271-
272- assert result_comment . id == blog . id
273- assert result_comment . thread == :blog
274- assert result_comment . comment_id == comment . id
275-
276- assert result_blog . id == blog . id
277- assert result_blog . thread == :blog
278- end
279- end
280224end
0 commit comments