Test that usernames with underscores get linked correctly

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
This commit is contained in:
Plastikmensch 2023-10-06 22:32:06 +02:00
parent 41bc94adf8
commit 5930fb7323
No known key found for this signature in database
GPG Key ID: 96381D586F4A6077

View File

@ -75,6 +75,15 @@ RSpec.describe AdvancedTextFormatter do
it 'creates a mention link' do it 'creates a mention link' do
expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>' expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>'
end end
context 'when username contains underscores' do
let(:preloaded_accounts) { [Fabricate(:account, username: '_bob_')] }
let(:text) { '@_bob_' }
it 'creates a mention link' do
expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@_bob_" class="u-url mention">@<span>_bob_</span></a></span>'
end
end
end end
context 'with text containing unlinkable mentions' do context 'with text containing unlinkable mentions' do