Repository navigation
iPadアーチ表示で直通運転時に路線カラーを区間ごとに色分け - #5325
Conversation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
📝 WalkthroughWalkthroughLineBoardYamanotePadが Changes
Sequence Diagram(s)sequenceDiagram
participant Hook as useCurrentTrainType
participant Pad as LineBoardYamanotePad
participant Arch as PadArch
Hook->>Pad: trainType (lines)
Pad->>Arch: props (stations, trainTypeLines, fallbackColor, height)
Arch->>Arch: computeColorSegments(stations, trainTypeLines, ...)
Arch->>Arch: render dark layer + main color segments (SVG / Views)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 分 Possibly related PRs
概要(既存文の更新)LineBoardYamanotePadコンポーネントから 🐰 ウサギからのお祝いポエム
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/LineBoardYamanotePad.test.tsx (1)
13-20: モック追加は適切です。
useCurrentTrainTypeのモックがnullを返す設定は、既存テストの動作を維持しつつ、新しいフック依存関係に対応しています。ただし、
trainTypeLinesプロップがPadArchに渡されることを検証するテストケースの追加を検討してください。直通運転時の路線カラー色分け機能をカバーするために、useCurrentTrainTypeが実際のtrainType(linesを含む)を返すケースのテストがあると良いでしょう。💡 trainTypeLinesのテストケース例
it('trainTypeLinesがPadArchに正しく渡される', () => { const { useCurrentTrainType } = require('~/hooks'); const mockTrainType = { id: 1, lines: [ { id: 1, color: '#9acd32' }, { id: 2, color: '#f15a22' }, ], }; useCurrentTrainType.mockReturnValue(mockTrainType); render(<LineBoardYamanotePad stations={mockStations} />); expect(PadArch).toHaveBeenCalledWith( expect.objectContaining({ trainTypeLines: mockTrainType.lines, }), undefined ); });As per coding guidelines: "Update or add tests relevant to code changes before submitting."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/LineBoardYamanotePad.test.tsx` around lines 13 - 20, Add a unit test in LineBoardYamanotePad.test.tsx that mocks useCurrentTrainType to return a realistic trainType object (including a lines array) and verifies that the LineBoardYamanotePad component passes that lines array to PadArch via the trainTypeLines prop; specifically, require and set useCurrentTrainType.mockReturnValue(mockTrainType), render(<LineBoardYamanotePad stations={mockStations} />), and assert PadArch was called with expect.objectContaining({ trainTypeLines: mockTrainType.lines }); this ensures the PadArch prop wiring for direct-run line color splitting is covered.
🤖 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/LineBoardYamanotePad.test.tsx`:
- Around line 13-20: Add a unit test in LineBoardYamanotePad.test.tsx that mocks
useCurrentTrainType to return a realistic trainType object (including a lines
array) and verifies that the LineBoardYamanotePad component passes that lines
array to PadArch via the trainTypeLines prop; specifically, require and set
useCurrentTrainType.mockReturnValue(mockTrainType), render(<LineBoardYamanotePad
stations={mockStations} />), and assert PadArch was called with
expect.objectContaining({ trainTypeLines: mockTrainType.lines }); this ensures
the PadArch prop wiring for direct-run line color splitting is covered.
Co-Authored-By: Claude Opus 4.6 [email protected]
Summary by CodeRabbit
リリースノート