slugify.spec.tsx 769 B

123456789101112131415161718192021222324252627
  1. import slugify from 'sentry/utils/slugify';
  2. describe('slugify', function () {
  3. it('forces to lowercase', function () {
  4. expect(slugify('STOPYELLING')).toBe('stopyelling');
  5. });
  6. it('replaces spaces with a hyphen', function () {
  7. expect(slugify('STOP YELLING')).toBe('stop-yelling');
  8. });
  9. it('replaces accented characters', function () {
  10. expect(slugify('Áá')).toBe('aa');
  11. });
  12. it('splits ligatures', function () {
  13. expect(slugify('fi')).toBe('fi');
  14. });
  15. it('Removes special characters', function () {
  16. expect(slugify("some#chars%shouldn't*be.here")).toBe('somecharsshouldntbehere');
  17. });
  18. it('keeps hyphens and underscores', function () {
  19. expect(slugify('_some-chars__should-stay')).toBe('_some-chars__should-stay');
  20. });
  21. });