Add some basic test cases for normalizeBranchName

This commit is contained in:
Caleb Owens 2024-05-03 20:16:02 +01:00
parent 63ee99b647
commit 32a8992af6

View File

@ -0,0 +1,16 @@
import { normalizeBranchName } from '$lib/utils/branch';
import { describe, expect, test } from 'vitest';
describe.concurrent('normalizeBranchName', () => {
test('it should remove undesirable symbols', () => {
expect(normalizeBranchName('a£^&*() b')).toEqual('a-b');
});
test('it should preserve capital letters', () => {
expect(normalizeBranchName('Hello World')).toEqual('Hello-World');
});
test('it should preserve `#`, `_`, `/`, and `.`', () => {
expect(normalizeBranchName('hello#_./world')).toEqual('hello#_./world');
});
});