feat(lookup): 用户前缀查找放宽至单字符——中文姓氏单字搜索(全链路)

契约 minLength 2→1 + 服务端 bounds 1..64 + admin 两处/App 一处前端门槛
同步放宽;防抖测试基线更新('s' 与合并后 'sta' 共两条)。

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-29 15:37:41 +08:00
parent b0a3515bf2
commit 53c25697a6
8 changed files with 34 additions and 19 deletions
+11 -3
View File
@@ -258,9 +258,17 @@ describe('账号查询 GET /admin/users (e2e)', () => {
expect(empty.status).toBe(400);
expect(empty.body.code).toBe(ErrorCodes.VALIDATION_FAILED);
const short = await lookup(staffToken, { accountPrefix: 'a' });
expect(short.status).toBe(400);
expect(short.body.code).toBe(ErrorCodes.VALIDATION_FAILED);
// 单字符已合法(2026-09-29 自 2 放宽——中文姓氏单字搜索):'a' 命中
// alice/albert(displayName 前缀并入后 '爱' 亦单字可用)。
const single = await lookup(staffToken, { accountPrefix: 'a' });
expect(single.status).toBe(200);
expect(single.body.items.map((i: { account: string }) => i.account)).toEqual([
'albert',
'alice',
]);
const singleName = await lookup(staffToken, { accountPrefix: '爱' });
expect(singleName.status).toBe(200);
expect(singleName.body.items).toHaveLength(1);
const long = await lookup(staffToken, { accountPrefix: 'a'.repeat(65) });
expect(long.status).toBe(400);