import { describe, test, expect } from 'vitest';
import { camelCaseToDisplay, getNextEntityName, isUuid, validateEmail } from './string.js';
describe('camel case to display', () => {
    test('can convert camel case to display', () => {
        expect(camelCaseToDisplay('testCamelCase')).toBe('Test Camel Case');
    });
});
describe('validate email', () => {
    test('can validate email', () => {
        expect(validateEmail('somebody@domain.com')).toBe(true);
        expect(validateEmail('somebody+test@domain.com')).toBe(true);
        expect(validateEmail('some-body_123@domain.com')).toBe(true);
        expect(validateEmail('somebody@domain.another.com')).toBe(true);
        expect(validateEmail('somebody@place@domain.com')).toBe(false);
        expect(validateEmail('some<>body@domain.com')).toBe(false);
    });
});
describe('isUuid', () => {
    test('accepts canonical RFC 4122-style UUIDs (case-insensitive)', () => {
        expect(isUuid('a1b2c3d4-e5f6-7890-abcd-1234567890ab')).toBe(true);
        expect(isUuid('A1B2C3D4-E5F6-7890-ABCD-1234567890AB')).toBe(true);
        expect(isUuid('00000000-0000-0000-0000-000000000000')).toBe(true);
    });
    test('rejects non-UUID strings without throwing', () => {
        // Strictness is the contract — these are the shapes PostgreSQL would
        // reject with `invalid input syntax for type uuid` if forwarded to a
        // UUID column.
        expect(isUuid('not-a-uuid')).toBe(false);
        expect(isUuid('unknown agent id')).toBe(false);
        // Near-miss: first segment is 7 chars instead of 8.
        expect(isUuid('1234567-1234-1234-1234-123456789abc')).toBe(false);
        // Too many segments.
        expect(isUuid('a1b2c3d4-e5f6-7890-abcd-1234567890ab-extra')).toBe(false);
        // Non-hex character.
        expect(isUuid('a1b2c3d4-e5f6-7890-abcd-1234567890zz')).toBe(false);
        // Empty string.
        expect(isUuid('')).toBe(false);
    });
    test('rejects non-string inputs', () => {
        expect(isUuid(null)).toBe(false);
        expect(isUuid(undefined)).toBe(false);
        expect(isUuid(123)).toBe(false);
        expect(isUuid({})).toBe(false);
    });
});
describe('getNextEntityName', () => {
    test('get next name with underscore', async () => {
        expect(getNextEntityName('Tabs_', ['Tabs_1', 'Tabs_2', 'Tabs_3'])).toEqual('Tabs_4');
        expect(getNextEntityName('Tabs_', ['Tabs_1', 'Tabs_2', 'Tabs_5'])).toEqual('Tabs_6');
        expect(getNextEntityName('Tabs_', [])).toEqual('Tabs_1');
        expect(getNextEntityName('Tabs_', ['Tabs_____1', 'Tabs__2', 'Tabs___3'])).toEqual('Tabs_4');
    });
    test('get next name with space', async () => {
        expect(getNextEntityName('Tabs ', ['Tabs 1', 'Tabs 2', 'Tabs 3'], ' ')).toEqual('Tabs 4');
        expect(getNextEntityName('Tabs ', ['Tabs 1', 'Tabs 2', 'Tabs 5'], ' ')).toEqual('Tabs 6');
        expect(getNextEntityName('Tabs ', [], ' ')).toEqual('Tabs 1');
        expect(getNextEntityName('Tabs ', ['Tabs     1', 'Tabs  2', 'Tabs   3'], ' ')).toEqual('Tabs 4');
        expect(getNextEntityName('Tabs ', ['Tabs 1', 'Tabs 2      ', 'Tabs 3  '], ' ')).toEqual('Tabs 4');
    });
});
//# sourceMappingURL=string.test.js.map