mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Chinese search tests
This commit is contained in:
parent
e05aa9bdc8
commit
6559de0085
1 changed files with 17 additions and 0 deletions
|
@ -335,5 +335,22 @@ describe Search do
|
|||
|
||||
end
|
||||
|
||||
describe 'Chinese search' do
|
||||
it 'splits English / Chinese' do
|
||||
SiteSetting.default_locale = 'zh_CN'
|
||||
data = Search.prepare_data('Discourse社区指南').split(' ')
|
||||
data.should == ['Discourse', '社区','指南']
|
||||
end
|
||||
|
||||
it 'finds chinese topic based on title' do
|
||||
SiteSetting.default_locale = 'zh_TW'
|
||||
topic = Fabricate(:topic, title: 'My Title Discourse社区指南')
|
||||
Fabricate(:post, topic: topic)
|
||||
|
||||
Search.new('社区指南').execute[0][:results][0][:id].should == topic.id
|
||||
Search.new('指南').execute[0][:results][0][:id].should == topic.id
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue