about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-04-22 19:13:02 +0200
committerGitHub <noreply@github.com>2023-04-22 19:13:02 +0200
commit2ebbfebfe9c7c967e3bcc9da0eec4628f9188233 (patch)
treeed3fa3f23d520e99fdd8b19597992b59a47aaa7d /spec/models
parentf30c5e7f15f967019245d2c78f3c2e89800eb838 (diff)
parent9ef32ea570fd0db63bd75714cd847abad6833345 (diff)
Merge pull request #2192 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/account_filter_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/account_filter_spec.rb b/spec/models/account_filter_spec.rb
index 3032260fe..cb00e7609 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