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 10:06:11 +0200
committerClaire <claire.github-309c@sitedethib.com>2023-04-22 10:06:11 +0200
commitabfdafef1ededdb87f018414edd6b25fa9a70525 (patch)
tree7a9855d79d125333a6b1307215b73dd507475320 /spec/models
parentf30c5e7f15f967019245d2c78f3c2e89800eb838 (diff)
parent4db8230194258a9a1c3d17d7261608515f3f2067 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/controllers/auth/setup_controller.rb`:
  Upstream removed a method close to a glitch-soc theming-related method.
  Removed the method like upstream did.
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