@@ -23,76 +23,76 @@ defmodule GroupherServer.Test.CMS.Search do
23
23
24
24
describe "[cms search post]" do
25
25
test "search post by full title should valid paged posts" do
26
- { :ok , searched } = CMS . search_contents ( :post , % { title: "react" } )
26
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "react" } )
27
27
28
28
assert searched |> is_valid_pagination? ( :raw )
29
29
assert searched . total_count == 1
30
30
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
31
31
end
32
32
33
33
test "search post blur title should return valid communities" do
34
- { :ok , searched } = CMS . search_contents ( :post , % { title: "reac" } )
34
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "reac" } )
35
35
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
36
36
37
- { :ok , searched } = CMS . search_contents ( :post , % { title: "rea" } )
37
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "rea" } )
38
38
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
39
39
40
- { :ok , searched } = CMS . search_contents ( :post , % { title: "eac" } )
40
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "eac" } )
41
41
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
42
42
43
- { :ok , searched } = CMS . search_contents ( :post , % { title: "每日" } )
43
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "每日" } )
44
44
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "每日妹子"
45
45
46
- { :ok , searched } = CMS . search_contents ( :post , % { title: "javasc" } )
46
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "javasc" } )
47
47
assert searched . total_count == 1
48
48
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "javascript"
49
49
50
- { :ok , searched } = CMS . search_contents ( :post , % { title: "java" } )
50
+ { :ok , searched } = CMS . search_articles ( :post , % { title: "java" } )
51
51
assert searched . total_count == 2
52
52
assert searched . entries |> Enum . any? ( & ( & 1 . title == "java" ) )
53
53
assert searched . entries |> Enum . any? ( & ( & 1 . title == "javascript" ) )
54
54
end
55
55
56
56
test "search non exsit community should get empty pagi data" do
57
- { :ok , searched } = CMS . search_contents ( :community , % { title: "non-exsit" } )
57
+ { :ok , searched } = CMS . search_communities ( % { title: "non-exsit" } )
58
58
assert searched |> is_valid_pagination? ( :raw , :empty )
59
59
end
60
60
end
61
61
62
62
describe "[cms search community]" do
63
63
test "search community by full title should valid paged communities" do
64
- { :ok , searched } = CMS . search_contents ( :community , % { title: "react" } )
64
+ { :ok , searched } = CMS . search_communities ( % { title: "react" } )
65
65
66
66
assert searched |> is_valid_pagination? ( :raw )
67
67
assert searched . total_count == 1
68
68
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
69
69
end
70
70
71
71
test "search community blur title should return valid communities" do
72
- { :ok , searched } = CMS . search_contents ( :community , % { title: "reac" } )
72
+ { :ok , searched } = CMS . search_communities ( % { title: "reac" } )
73
73
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
74
74
75
- { :ok , searched } = CMS . search_contents ( :community , % { title: "rea" } )
75
+ { :ok , searched } = CMS . search_communities ( % { title: "rea" } )
76
76
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
77
77
78
- { :ok , searched } = CMS . search_contents ( :community , % { title: "eac" } )
78
+ { :ok , searched } = CMS . search_communities ( % { title: "eac" } )
79
79
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
80
80
81
- { :ok , searched } = CMS . search_contents ( :community , % { title: "每日" } )
81
+ { :ok , searched } = CMS . search_communities ( % { title: "每日" } )
82
82
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "每日妹子"
83
83
84
- { :ok , searched } = CMS . search_contents ( :community , % { title: "javasc" } )
84
+ { :ok , searched } = CMS . search_communities ( % { title: "javasc" } )
85
85
assert searched . total_count == 1
86
86
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "javascript"
87
87
88
- { :ok , searched } = CMS . search_contents ( :community , % { title: "java" } )
88
+ { :ok , searched } = CMS . search_communities ( % { title: "java" } )
89
89
assert searched . total_count == 2
90
90
assert searched . entries |> Enum . any? ( & ( & 1 . title == "java" ) )
91
91
assert searched . entries |> Enum . any? ( & ( & 1 . title == "javascript" ) )
92
92
end
93
93
94
94
test "search non exsit community should get empty pagi data" do
95
- { :ok , searched } = CMS . search_contents ( :community , % { title: "non-exsit" } )
95
+ { :ok , searched } = CMS . search_communities ( % { title: "non-exsit" } )
96
96
assert searched |> is_valid_pagination? ( :raw , :empty )
97
97
end
98
98
end