mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-26 20:44:47 +03:00
cd176faf4e
Reject reserved dot-segment client names and recover legacy records through query aliases. Preserve token scopes and path identity precedence, and update the generated API reference.
23 lines
816 B
TypeScript
23 lines
816 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { ClientCreateFormSchema, ClientFormSchema } from '@/schemas/client';
|
|
|
|
describe('client name validation', () => {
|
|
it.each(['.', '..', ' . ', ' .. '])('rejects the reserved name %j on create and edit', (name) => {
|
|
for (const schema of [ClientCreateFormSchema, ClientFormSchema]) {
|
|
const result = schema.shape.email.safeParse(name);
|
|
expect(result.success).toBe(false);
|
|
if (!result.success) {
|
|
expect(result.error.issues[0].message).toBe('pages.clients.emailReservedName');
|
|
}
|
|
}
|
|
});
|
|
|
|
it.each(['...', '.alice', 'alice.', 'alice.example', 'alice..example', 'alice@example.com'])(
|
|
'preserves ordinary dotted names: %s',
|
|
(name) => {
|
|
expect(ClientFormSchema.shape.email.parse(name)).toBe(name);
|
|
},
|
|
);
|
|
});
|