Skip to content

test(ui): rewardsMenuIcon 切片对齐 #49 后的 footer 形态,修复 main 上静默崩溃 - #58

Open
yachen4ever wants to merge 1 commit into
ZCodium-project:mainfrom
yachen4ever:fix/rewards-menu-icon-test
Open

yachen4ever wants to merge 1 commit into
ZCodium-project:mainfrom
yachen4ever:fix/rewards-menu-icon-test

Conversation

@yachen4ever

Copy link
Copy Markdown
Collaborator

Closes #55

改动(1 文件,+8/−3)

packages/ui/test/rewardsMenuIcon.test.ts 第一个用例的源码切片逻辑更新:

  • fix(ui): remove footer login entry and restore fa-IR shortcut #49(577bac82)移除了 WorkspaceSidebarFooter.tsx 的登录入口,源文件里已不存在该用例依赖的结尾标记 {onLogin && !user,indexOf 返回 -1 后切出残缺 JSX,转译即抛 SyntaxError: Unexpected token ')'——main 上静默失败(仓库 CI 无 test:unit job)。
  • 新切片按 data-testid="rewards-menu-item" 锚点定位其所属的 {user ? (<DropdownMenuItem>…) : null} 自包含块(fix(ui): remove footer login entry and restore fa-IR shortcut #49 之后 rewards 条目即此形态),拼接成平衡表达式后转译。
  • 切片边界加显式断言:将来标记再漂移时表现为可读的断言失败,而不是转译期 SyntaxError。

用例的验收语义不变:匿名渲染为空、登录后渲染出 rewards 菜单项与奖励徽标;同文件其余 3 个用例未动。

验证

  • pnpm test:unit packages/ui/test/rewardsMenuIcon.test.ts:4/4 通过(修复前 1/4)。
  • pnpm lint:0 错误。

…n 上静默崩溃

ZCodium-project#49 移除登录入口后源文件不再含 {onLogin && !user 标记,原切片 indexOf 返回 -1
切出残缺 JSX,转译抛 SyntaxError。改为按 rewards-menu-item 锚点定位其自包含的
{user ? (…) : null} 块并拼接平衡表达式,边界加显式断言防标记漂移静默化。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(ui): #49 移除 footer 登录入口后未更新 rewardsMenuIcon.test.ts,main 上切片解析崩溃

1 participant