@@ -35,17 +35,16 @@ defmodule GroupherServer.Test.CMS.ArticlePin do
3535 assert pind_article . post_id == post . id
3636 end
3737
38- @ tag :wip
38+ @ tag :wip2
3939 test "one community & thread can only pin certern count of post" , ~m( community post user) a do
40- { :ok , _post2 } = CMS . create_content ( community , :post , mock_attrs ( :post ) , user )
41- { :ok , post3 } = CMS . create_content ( community , :post , mock_attrs ( :post ) , user )
42-
4340 Enum . reduce ( 1 .. @ max_pinned_article_count_per_thread , [ ] , fn _ , acc ->
44- { :ok , _ } = CMS . pin_article ( :post , post . id , community . id )
41+ { :ok , new_post } = CMS . create_content ( community , :post , mock_attrs ( :post ) , user )
42+ { :ok , _ } = CMS . pin_article ( :post , new_post . id , community . id )
4543 acc
4644 end )
4745
48- { :error , reason } = CMS . pin_article ( :post , post3 . id , community . id )
46+ { :ok , new_post } = CMS . create_content ( community , :post , mock_attrs ( :post ) , user )
47+ { :error , reason } = CMS . pin_article ( :post , new_post . id , community . id )
4948 assert reason |> Keyword . get ( :code ) == ecode ( :too_much_pinned_article )
5049 end
5150
@@ -54,12 +53,11 @@ defmodule GroupherServer.Test.CMS.ArticlePin do
5453 assert { :error , _ } = CMS . pin_article ( :post , 8848 , community . id )
5554 end
5655
57- @ tag :wip
56+ @ tag :wip2
5857 test "can undo pin to a post" , ~m( community post) a do
5958 { :ok , _ } = CMS . pin_article ( :post , post . id , community . id )
6059
6160 assert { :ok , unpinned } = CMS . undo_pin_article ( :post , post . id , community . id )
62- assert unpinned . post_id == post . id
6361
6462 assert { :error , _ } = ORM . find_by ( PinnedArticle , % { post_id: post . id } )
6563 end
0 commit comments