Truncate slug values to 63 characters.

This commit is contained in:
Franz Diebold 2022-09-11 14:19:45 +00:00
parent 960f2f11d8
commit 9d7426b893
3 changed files with 25 additions and 12 deletions

View file

@ -6,6 +6,16 @@ test('slugifies text', () => {
expect(slugify(' /abc+efg*123/test§xyz ')).toEqual('abc-efg-123-test-xyz');
});
test('slugifies a text to a maximum length', () => {
expect(slugify(' /abc+efg*123/test§xyz 1234567 /(ö) ', 16))
.toEqual('abc-efg-123-test');
});
test('slugifies a text to a maximum length with trailing dash', () => {
expect(slugify(' /abc+efg*123/test§xyz 1234567 /(ö) ', 17))
.toEqual('abc-efg-123-test');
});
test('slugifies ref name with dash', () => {
expect(slugify('feat/feature-branch-1')).toEqual('feat-feature-branch-1');
});