diff options
author | Heitor de Melo Cardozo <heitor711n@gmail.com> | 2023-04-17 09:16:36 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 14:16:36 +0200 |
commit | bc75e62ca6e16d3dad43fd35ccca335de547cfb3 (patch) | |
tree | e156d5585a38d753fa793fe5afb63172b8090ec3 /spec/models | |
parent | ab740f464a8e5aa6b5f78c0ddab3c8e18698d810 (diff) |
Change moderation search an account using the username with @ (#24242)
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/account_filter_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/account_filter_spec.rb b/spec/models/account_filter_spec.rb index 3032260fefa..cb00e760965 100644 --- a/spec/models/account_filter_spec.rb +++ b/spec/models/account_filter_spec.rb @@ -44,4 +44,23 @@ describe AccountFilter do expect(filter.results).to match_array [remote_account_one] end end + + describe 'with username' do + let!(:local_account) { Fabricate(:account, domain: nil, username: 'validUserName') } + + it 'works with @ at the beginning of the username' do + filter = described_class.new(username: '@validUserName') + expect(filter.results).to match_array [local_account] + end + + it 'does not work with more than one @ at the beginning of the username' do + filter = described_class.new(username: '@@validUserName') + expect(filter.results).to_not match_array [local_account] + end + + it 'does not work with @ outside the beginning of the username' do + filter = described_class.new(username: 'validUserName@') + expect(filter.results).to_not match_array [local_account] + end + end end |