-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($shared-utils): replace diacritics with regex (#1855)
- Loading branch information
Sergey Larionov
committed
Aug 19, 2020
1 parent
ede84fe
commit b35e451
Showing
2 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import slugify from '../src/slugify' | ||
|
||
describe('slugify', () => { | ||
test('should slugify', () => { | ||
const asserts: Record<string, string> = { | ||
'Привет': 'привет', | ||
'Лед üäöß': 'лед-uaoß', | ||
'hangul 가': 'hangul-가', | ||
'ع': 'ع', | ||
'džℍΩ': 'dzhω', | ||
'カi⁹': 'カi9', | ||
// ㌀ -> アパート' | ||
'㌀': decodeURIComponent('%E3%82%A2%E3%83%8F%E3%82%9A%E3%83%BC%E3%83%88'), | ||
'¼': '_1⁄4', | ||
'džℍΩカi⁹¼': 'dzhωカi91⁄4', | ||
'Iлtèrnåtïonɑlíƶatï߀ԉ': 'iлternationɑliƶati߀ԉ', | ||
'Båcòл ípѕùm ðoɭ߀r ѕït aϻèt âùþê aԉᏧ߀üïlɭê ƃëéf culρá fïlèt ϻiǥnòn cuρiᏧatat ut êлim tòлɢùê.': | ||
'bacoл-ipѕum-ðoɭ߀r-ѕit-aϻet-auþe-aԉꮷ߀uilɭe-ƃeef-culρa-filet-ϻiǥnon-cuρiꮷatat-ut-eлim-toлɢue', | ||
'ᴎᴑᴅᴇȷʂ': 'ᴎᴑᴅᴇȷʂ', | ||
'hambúrguer': 'hamburguer', | ||
'hŒllœ': 'hœllœ', | ||
'Fußball': 'fußball', | ||
'ABCDEFGHIJKLMNOPQRSTUVWXYZé': 'abcdefghijklmnopqrstuvwxyze' | ||
} | ||
|
||
Object.keys(asserts).forEach(input => { | ||
expect(slugify(input)).toBe(asserts[input]) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters