Repository navigation
TOEIテーマのLineBoardで無効化された言語の併記表示を非表示にする - #5770
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughStationNameToei に言語フラグを追加し、navigationState の enabledLanguages を参照して中国語・韓国語の表示を条件付きで制御するように変更。テストを更新し、useAtomValue の Jest モックをアトムのブランドで分岐する実装に置き換えた。 Changes
Sequence Diagram(s)(該当する変更ではシーケンス図を省略します) 推定コードレビュー負荷🎯 3 (Moderate) | ⏱️ ~25 minutes 詩
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/components/LineBoardToei.test.tsx (2)
117-131: 無効化ケース(KO/ZH OFF)の回帰テストも追加したいです。Line 125 で常に
['JA', 'EN', 'ZH', 'KO']を返しているため、今回の主目的である「無効時に併記を非表示」の検証が不足しています。enabledLanguagesからKO/ZHを外したケースを1-2件追加すると回帰耐性が上がります。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/LineBoardToei.test.tsx` around lines 117 - 131, The mockUseAtomValue helper always returns enabledLanguages = ['JA','EN','ZH','KO'], so add one or two regression test cases that simulate disabled languages by altering mockUseAtomValue's branch for the 'navigationState' atom to return variants without 'KO' and/or 'ZH' (e.g., ['JA','EN'] and ['JA','EN','ZH']), then assert in the corresponding tests that bilingual labels for the disabled languages are not rendered; update tests that call mockUseAtomValue in LineBoardToei.test.tsx (the mockUseAtomValue function and the tests around its usage) to include these scenarios.
242-257:useAtomValue分岐モックの重複はヘルパー化すると保守しやすいです。Line 117-131 とほぼ同じ分岐が再定義されているので、
selectedLineだけ差し替え可能なヘルパーに寄せると変更時の追従漏れを防げます。差分例
- useAtomValue.mockImplementation((atomVal: unknown) => { - if (atomVal && (atomVal as { __brand?: string }).__brand === 'isEnAtom') { - return false; - } - if ( - atomVal && - (atomVal as { __brand?: string }).__brand === 'navigationState' - ) { - return { enabledLanguages: ['JA', 'EN', 'ZH', 'KO'] }; - } - return { - station: mockStations[0], - arrived: true, - selectedLine: null, - }; - }); + const createAtomValueMock = + (overrides: Record<string, unknown> = {}) => + (atomVal: unknown) => { + if ((atomVal as { __brand?: string })?.__brand === 'isEnAtom') return false; + if ((atomVal as { __brand?: string })?.__brand === 'navigationState') { + return { enabledLanguages: ['JA', 'EN', 'ZH', 'KO'] }; + } + return { station: mockStations[0], arrived: true, ...overrides }; + }; + + useAtomValue.mockImplementation(createAtomValueMock({ selectedLine: null }));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/LineBoardToei.test.tsx` around lines 242 - 257, The duplicated branching mock for useAtomValue in LineBoardToei.test.tsx should be extracted into a reusable helper (e.g., createUseAtomValueMock or getUseAtomValueMock) that returns the common defaults and accepts an override for selectedLine; replace both inline mockImplementation blocks with calls to this helper (pass selectedLine=null or your test-specific value) so the navigationState and isEnAtom branches live in one place and selectedLine is easily swapped per test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/LineBoardToei.test.tsx`:
- Around line 117-131: The mockUseAtomValue helper always returns
enabledLanguages = ['JA','EN','ZH','KO'], so add one or two regression test
cases that simulate disabled languages by altering mockUseAtomValue's branch for
the 'navigationState' atom to return variants without 'KO' and/or 'ZH' (e.g.,
['JA','EN'] and ['JA','EN','ZH']), then assert in the corresponding tests that
bilingual labels for the disabled languages are not rendered; update tests that
call mockUseAtomValue in LineBoardToei.test.tsx (the mockUseAtomValue function
and the tests around its usage) to include these scenarios.
- Around line 242-257: The duplicated branching mock for useAtomValue in
LineBoardToei.test.tsx should be extracted into a reusable helper (e.g.,
createUseAtomValueMock or getUseAtomValueMock) that returns the common defaults
and accepts an override for selectedLine; replace both inline mockImplementation
blocks with calls to this helper (pass selectedLine=null or your test-specific
value) so the navigationState and isEnAtom branches live in one place and
selectedLine is easily swapped per test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f2ddecdb-ffd4-46d3-a7ca-775ce43fbc70
📒 Files selected for processing (2)
src/components/LineBoardToei.test.tsxsrc/components/LineBoardToei.tsx
https://claude.ai/code/session_01NMDiHx11nf3BxZZ1tjAWMc
Summary by CodeRabbit