mirror of
https://github.com/mroxso/zelo-news.git
synced 2026-06-06 02:21:11 +02:00
Normalize hashtags to lowercase when publishing blog posts
Co-authored-by: mroxso <24775431+mroxso@users.noreply.github.com>
This commit is contained in:
@@ -47,7 +47,7 @@ export function usePublishBlogPost() {
|
||||
|
||||
if (data.hashtags && data.hashtags.length > 0) {
|
||||
data.hashtags.forEach(tag => {
|
||||
tags.push(['t', tag]);
|
||||
tags.push(['t', tag.toLowerCase()]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -68,4 +68,16 @@ describe('detectSearchInputType', () => {
|
||||
expect(result.type).toBe('hashtag');
|
||||
expect(result.value).toBe('#bitcoin');
|
||||
});
|
||||
|
||||
it('detects hashtags with capital letters', () => {
|
||||
const result = detectSearchInputType('#BR');
|
||||
expect(result.type).toBe('hashtag');
|
||||
expect(result.value).toBe('#BR');
|
||||
});
|
||||
|
||||
it('detects hashtags with mixed case', () => {
|
||||
const result = detectSearchInputType('#Bitcoin');
|
||||
expect(result.type).toBe('hashtag');
|
||||
expect(result.value).toBe('#Bitcoin');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user