From d5df1e6a5e5c28854b491f8de21c1ce65171fab0 Mon Sep 17 00:00:00 2001 From: Katsuya HIDAKA Date: Thu, 18 Jun 2026 17:42:25 +0900 Subject: Add tests for mention autocomplete --- test/functional/watchers_controller_test.rb | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index c80dae2d7..62a5e5955 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.rb @@ -455,6 +455,32 @@ class WatchersControllerTest < Redmine::ControllerTest assert_not_include hidden.name, response.body end + def test_autocomplete_for_mention + @request.session[:user_id] = 1 + get :autocomplete_for_mention, params: { + project_id: 'ecookbook', + object_type: 'issue', + object_id: '1', + q: 'john' + }, xhr: true + + assert_response :success + assert_equal ['jsmith'], response.parsed_body.pluck('login') + end + + def test_autocomplete_for_mention_without_query + @request.session[:user_id] = 1 + get :autocomplete_for_mention, params: { + project_id: 'ecookbook', + object_type: 'issue', + object_id: '1', + q: '' + }, xhr: true + + assert_response :success + assert_equal ['dlopper', 'jsmith'], response.parsed_body.pluck('login') + end + def test_autocomplete_for_user_should_not_return_users_without_object_visibility @request.session[:user_id] = 1 get :autocomplete_for_user, :params => { -- 2.51.0