From 8e3e19a7d33e656ffe34141f58a66df99c386bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Sun, 20 Sep 2026 16:36:19 +0800 Subject: [PATCH] test(api): fix key-order expectation in users-lookup e2e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Object.keys().sort() 是码点序(大小写敏感):'localLocked'(大写 L)排 在 'locale' 之前;原断言字面量按不区分大小写的字母序书写导致确定性失败 (P4a Task 2 全量回归时暴露,与 HEAD 行为无关的既有笔误)。 Co-Authored-By: Claude Code --- services/api/test/users-lookup.e2e-spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/api/test/users-lookup.e2e-spec.ts b/services/api/test/users-lookup.e2e-spec.ts index cfce23c..324c524 100644 --- a/services/api/test/users-lookup.e2e-spec.ts +++ b/services/api/test/users-lookup.e2e-spec.ts @@ -137,7 +137,8 @@ describe('账号查询 GET /admin/users (e2e)', () => { expect(items.map((item) => item.id)).toEqual([albertId, aliceId]); expect(items.map((item) => item.displayName)).toEqual(['艾伯', '爱丽']); // 条目形状:AdminUser 字段集(治理字段随 P4a 统一暴露;仍无邮箱/手机/ - // 密码哈希等凭据字段)。 + // 密码哈希等凭据字段)。注意数组序 = Array#sort 的码点序(大小写敏感): + // 'localLocked'(大写 L,0x4C)排在 'locale'(e,0x65)之前。 for (const item of items) { expect(Object.keys(item).sort()).toEqual([ 'account', @@ -145,8 +146,8 @@ describe('账号查询 GET /admin/users (e2e)', () => { 'credentialStatus', 'displayName', 'id', - 'locale', 'localLocked', + 'locale', 'role', 'sourceStatus', ]);