backend: update theme name validation to allow uppercase letters
This commit is contained in:
parent
67dfd5df63
commit
0a97f05c58
@ -99,7 +99,7 @@ const RoomThemeSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1, 'Theme name cannot be empty')
|
.min(1, 'Theme name cannot be empty')
|
||||||
.max(50, 'Theme name cannot exceed 50 characters')
|
.max(50, 'Theme name cannot exceed 50 characters')
|
||||||
.regex(/^[a-z0-9_-]+$/, 'Theme name can only contain lowercase letters, numbers, hyphens and underscores'),
|
.regex(/^[a-zA-Z0-9_-]+$/, 'Theme name can only contain letters, numbers, hyphens and underscores'),
|
||||||
enabled: z.boolean(),
|
enabled: z.boolean(),
|
||||||
baseTheme: ThemeModeSchema,
|
baseTheme: ThemeModeSchema,
|
||||||
backgroundColor: hexColorSchema.optional(),
|
backgroundColor: hexColorSchema.optional(),
|
||||||
|
|||||||
@ -182,12 +182,9 @@ describe('Rooms Appearance Config API Tests', () => {
|
|||||||
|
|
||||||
it('should reject when theme name has invalid characters', async () => {
|
it('should reject when theme name has invalid characters', async () => {
|
||||||
const invalidNames = [
|
const invalidNames = [
|
||||||
'Corporate Blue', // Uppercase and spaces
|
'Corporate Blue', // Spaces
|
||||||
'dark-mode-2024!', // Exclamation mark
|
'dark-mode.2024!', // Special characters
|
||||||
'theme.corporate', // Dot
|
'thème_français' // Accents
|
||||||
'Dark_Mode', // Uppercase
|
|
||||||
'theme 1', // Space
|
|
||||||
'thème-français' // Accents
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const name of invalidNames) {
|
for (const name of invalidNames) {
|
||||||
@ -206,7 +203,7 @@ describe('Rooms Appearance Config API Tests', () => {
|
|||||||
expectValidationError(
|
expectValidationError(
|
||||||
response,
|
response,
|
||||||
'appearance.themes.0.name',
|
'appearance.themes.0.name',
|
||||||
'Theme name can only contain lowercase letters, numbers, hyphens and underscores'
|
'Theme name can only contain letters, numbers, hyphens and underscores'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user