diff --git a/src/lib.ts b/src/lib.ts index e7c5f46..91f190a 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -22,7 +22,7 @@ export function tap(value: any, interceptor: (v: any) => T) { export function normalizeDatabaseName(input: string) { return input .replace(/[\W_]+/g, '_') - .substring(0, 64) + .substring(0, 63) .replace(/^_|_$/g, '') .toLowerCase(); } diff --git a/tests/unit/lib.test.ts b/tests/unit/lib.test.ts index 1c33989..10b59cd 100644 --- a/tests/unit/lib.test.ts +++ b/tests/unit/lib.test.ts @@ -58,7 +58,7 @@ describe('normalizeDatabaseName', () => { ['one! two? three 0x995', 'one_two_three_0x995'], ['jbk/px-454', 'jbk_px_454'], ["please+don't %20 do / this", 'please_don_t_20_do_this'], - ['a'.repeat(65), 'a'.repeat(64)], + ['a'.repeat(65), 'a'.repeat(63)], ['FOO bar', 'foo_bar'], ])('%s → %s', (input, output) => { expect(normalizeDatabaseName(input)).toBe(output);