Files
Pavlos Koutoglou a3822e8d30 feat(git): name app-managed git folders after their project instead of a bare hex id (#10349)
* feat(git): implement folderSlug for Git repositories and add slugify utility

* fix(project): wait for modal backdrop to hide before clicking next button

* feat(git): enhance folderSlug validation and path resolution for Git repositories

* fix(git): improve fallback path resolution for git repositories to ensure safety

* fix(project): handle unsaved changes confirmation when closing project modal

* fix(project): handle race condition in unsaved changes confirmation dialog when closing project modal
2026-08-10 20:40:00 +03:00

30 lines
875 B
TypeScript

import { describe, expect, it } from 'vitest';
import { slugify } from './misc';
describe('slugify', () => {
it('lowercases and joins words with hyphens', () => {
expect(slugify('Cams Project!')).toBe('cams-project');
});
it('strips accents', () => {
expect(slugify('Café México')).toBe('cafe-mexico');
});
it('collapses runs of non-alphanumeric characters', () => {
expect(slugify(' --Weird__Name-- ')).toBe('weird-name');
});
it('returns an empty string when nothing usable remains', () => {
expect(slugify('🚀🚀🚀')).toBe('');
});
it('truncates to maxLength without leaving a trailing hyphen', () => {
const longName = 'a-very-long-project-name-that-goes-on-and-on-and-on';
const slug = slugify(longName, 20);
expect(slug.length).toBeLessThanOrEqual(20);
expect(slug.endsWith('-')).toBe(false);
});
});