From 9fc6a63bea6bc2c9732c8594fb9fd8f4d4fc3306 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 25 Jun 2025 12:29:40 +0200 Subject: [PATCH] fix 2 assumptions --- shared/src/schema/user.schema.test.ts | 15 +++++++++++++++ shared/src/schema/user.schema.ts | 1 - 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/shared/src/schema/user.schema.test.ts b/shared/src/schema/user.schema.test.ts index f29bb2af5..d8f91cb1e 100644 --- a/shared/src/schema/user.schema.test.ts +++ b/shared/src/schema/user.schema.test.ts @@ -41,6 +41,21 @@ describe('validate alias', () => { }) }) + describe('alias length', () => { + it('2 characters is not ok', () => { + expect(() => aliasSchema.parse('Bi')).toThrowError() + }) + it('3 characters is ok', () => { + expect(() => aliasSchema.parse('Bib')).not.toThrowError() + }) + it('20 characters is ok', () => { + expect(() => aliasSchema.parse('BibiBloxbergMondLich')).not.toThrowError() + }) + it('21 characters is not ok', () => { + expect(() => aliasSchema.parse('BibiBloxbergZauberwald')).toThrowError() + }) + }) + describe('alias is a reserved word with uppercase characters', () => { it('throws and logs an error', () => { expect(() => aliasSchema.parse('Admin')).toThrowError(expect.objectContaining( diff --git a/shared/src/schema/user.schema.ts b/shared/src/schema/user.schema.ts index 4a1c51d74..90897a637 100644 --- a/shared/src/schema/user.schema.ts +++ b/shared/src/schema/user.schema.ts @@ -14,7 +14,6 @@ const RESERVED_ALIAS = [ 'support', 'temp', 'tmp', - 'tmp', 'user', 'usr', 'var',