mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
add unit test
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
escapeTag,
|
||||
escapeTagRecursive,
|
||||
localeIncludes,
|
||||
replaceBioSymbols,
|
||||
textToHex
|
||||
} from '../string';
|
||||
|
||||
@@ -99,4 +100,36 @@ describe('String Utils', () => {
|
||||
expect(changeLogRemoveLinks('')).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('replaceBioSymbols', () => {
|
||||
test('replaces fullwidth symbols with ASCII equivalents', () => {
|
||||
expect(replaceBioSymbols('@user')).toBe('@user');
|
||||
expect(replaceBioSymbols('#tag')).toBe('#tag');
|
||||
expect(replaceBioSymbols('1+1=2')).toBe('1+1=2');
|
||||
});
|
||||
|
||||
test('replaces multiple different symbols', () => {
|
||||
expect(replaceBioSymbols('(hello)')).toBe('(hello)');
|
||||
expect(replaceBioSymbols('[test]')).toBe('[test]');
|
||||
expect(replaceBioSymbols('{obj}')).toBe('{obj}');
|
||||
});
|
||||
|
||||
test('collapses multiple spaces', () => {
|
||||
expect(replaceBioSymbols('hello world')).toBe('hello world');
|
||||
});
|
||||
|
||||
test('handles non-string input', () => {
|
||||
expect(replaceBioSymbols(null)).toBe('');
|
||||
expect(replaceBioSymbols(undefined)).toBe('');
|
||||
expect(replaceBioSymbols(123)).toBe('');
|
||||
});
|
||||
|
||||
test('handles empty string', () => {
|
||||
expect(replaceBioSymbols('')).toBe('');
|
||||
});
|
||||
|
||||
test('preserves normal ASCII text', () => {
|
||||
expect(replaceBioSymbols('hello world')).toBe('hello world');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user