Fix hashtags not being picked up when full-width hash sign is used (#36103)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -35,12 +35,24 @@ RSpec.describe Extractor do
|
||||
end
|
||||
|
||||
describe 'extract_hashtags_with_indices' do
|
||||
it 'returns an empty array if it does not have #' do
|
||||
it 'returns an empty array if it does not have # or #' do
|
||||
text = 'a string without hash sign'
|
||||
extracted = described_class.extract_hashtags_with_indices(text)
|
||||
expect(extracted).to eq []
|
||||
end
|
||||
|
||||
it 'returns hashtags preceded by an ASCII hash' do
|
||||
text = 'hello #world'
|
||||
extracted = described_class.extract_hashtags_with_indices(text)
|
||||
expect(extracted).to eq [{ hashtag: 'world', indices: [6, 12] }]
|
||||
end
|
||||
|
||||
it 'returns hashtags preceded by a full-width hash' do
|
||||
text = 'hello #world'
|
||||
extracted = described_class.extract_hashtags_with_indices(text)
|
||||
expect(extracted).to eq [{ hashtag: 'world', indices: [6, 12] }]
|
||||
end
|
||||
|
||||
it 'does not exclude normal hash text before ://' do
|
||||
text = '#hashtag://'
|
||||
extracted = described_class.extract_hashtags_with_indices(text)
|
||||
|
||||
Reference in New Issue
Block a user