@@ -54,45 +54,46 @@ defmodule GroupherServer.Test.CMS.Search do
54
54
end
55
55
56
56
test "search non exsit community should get empty pagi data" do
57
- { :ok , searched } = CMS . search_communities ( % { title: "non-exsit" } )
57
+ { :ok , searched } = CMS . search_communities ( "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_communities ( % { title: "react" } )
64
+ { :ok , searched } = CMS . search_communities ( "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
+ @ tag :wip2
71
72
test "search community blur title should return valid communities" do
72
- { :ok , searched } = CMS . search_communities ( % { title: "reac" } )
73
+ { :ok , searched } = CMS . search_communities ( "reac" )
73
74
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
74
75
75
- { :ok , searched } = CMS . search_communities ( % { title: "rea" } )
76
+ { :ok , searched } = CMS . search_communities ( "rea" )
76
77
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
77
78
78
- { :ok , searched } = CMS . search_communities ( % { title: "eac" } )
79
+ { :ok , searched } = CMS . search_communities ( "eac" )
79
80
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "react"
80
81
81
- { :ok , searched } = CMS . search_communities ( % { title: "每日" } )
82
+ { :ok , searched } = CMS . search_communities ( "每日" )
82
83
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "每日妹子"
83
84
84
- { :ok , searched } = CMS . search_communities ( % { title: "javasc" } )
85
+ { :ok , searched } = CMS . search_communities ( "javasc" )
85
86
assert searched . total_count == 1
86
87
assert searched . entries |> Enum . at ( 0 ) |> Map . get ( :title ) == "javascript"
87
88
88
- { :ok , searched } = CMS . search_communities ( % { title: "java" } )
89
+ { :ok , searched } = CMS . search_communities ( "java" )
89
90
assert searched . total_count == 2
90
91
assert searched . entries |> Enum . any? ( & ( & 1 . title == "java" ) )
91
92
assert searched . entries |> Enum . any? ( & ( & 1 . title == "javascript" ) )
92
93
end
93
94
94
95
test "search non exsit community should get empty pagi data" do
95
- { :ok , searched } = CMS . search_communities ( % { title: "non-exsit" } )
96
+ { :ok , searched } = CMS . search_communities ( "non-exsit" )
96
97
assert searched |> is_valid_pagination? ( :raw , :empty )
97
98
end
98
99
end