Skip to content

PassChevronTYをPassChevronEastに改名、その他リファクタリング - #5787

Merged
TinyKitten merged 2 commits into
devfrom
chore/component-name-refactor
Apr 8, 2026
Merged

TinyKitten merged 2 commits into
devfrom
chore/component-name-refactor

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Apr 8, 2026 •

Copy link
Copy Markdown
Member

概要

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

関連Issue

スクリーンショット(任意)

Summary by CodeRabbit

リリースノート

  • Refactor
    • 駅マーカーの通過インジケーターを別デザインに切替え、表示ロジックを整理しました
  • Bug Fixes
    • 通過表示が期待どおり描画されるように修正しました
  • Tests
    • 通過表示に関連するテストを更新し、期待値を新デザインに合わせました

@github-actions github-actions Bot added the react label Apr 8, 2026
@coderabbitai

coderabbitai Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

PassChevronTY が PassChevronEast に置き換えられ、LineDot の prop 名 round が isOdakyu に改名されました。関連するインポート、JSX、テストのモック定義が複数ファイルで更新されています。

Changes

Cohort / File(s) Summary
テストファイルの更新
src/components/LineBoard/shared/components/LineDot.test.tsx, src/components/LineBoardJO.test.tsx
jest.mock とテスト内の参照を PassChevronTY → PassChevronEast に変更。testID アサーションも pass-chevron-ty → pass-chevron-east に更新。
コンポーネント定義の改名
src/components/PassChevronEast.tsx
コンポーネント名およびデフォルトエクスポートを PassChevronTY から PassChevronEast にリネーム。
コンポーネント使用箇所の更新
src/components/LineBoardE231.tsx, src/components/LineBoardJO.tsx, src/components/.../LineDot.tsx
インポートと JSX 内の使用を PassChevronTY → PassChevronEast に置換(gradient={false} 等の渡し方は継続)。
プロパティ名の改名と呼び出し更新
src/components/LineBoard/shared/components/LineDot.tsx, src/components/LineBoardEast.tsx
LineDot の prop を round?: boolean → isOdakyu?: boolean に変更。条件付きグラデーションやスタイル判定を新プロパティ名に切替え、呼び出し側で round={isOdakyu} → isOdakyu={isOdakyu} に更新。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 東へ跳んだ PassChevron、ぴょん、
round は名を変え、isOdakyu に、
テストも追いかけて揃い踏み、
小さな修正で道はすっきり、
にんじん片手に祝杯を一つ。

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning PRの説明は形式に沿っていますが、「変更内容」セクションが記入されていないため重要な情報が不足しています。 「変更内容」セクションを記入し、PassChevronTYからPassChevronEastへの改名理由、lineDotのroundからisOdakuyuへのプロパティ変更など、具体的な変更内容を詳述してください。
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルはPassChevronTYをPassChevronEastへの改名とリファクタリングを明確に示しており、変更内容の主要な部分を正確に要約しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/component-name-refactor

Comment @coderabbitai help to get the list of available commands and usage tips.

@TinyKitten TinyKitten self-assigned this Apr 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/components/LineBoard/shared/components/LineDot.test.tsx (1)

34-41: testIDの命名がコンポーネント名と不整合です。

モックのパスは PassChevronEast に更新されていますが、testIDは pass-chevron-ty のままです。一貫性のため pass-chevron-east に更新することを推奨します。

♻️ 修正案
 jest.mock('../../../PassChevronEast', () => {
   const _React = require('react');
   const { View } = require('react-native');
   return {
     __esModule: true,
-    default: () => <View testID="pass-chevron-ty" />,
+    default: () => <View testID="pass-chevron-east" />,
   };
 });

Line 75, 93のアサーションも同様に更新が必要です:

-    expect(getByTestId('pass-chevron-ty')).toBeTruthy();
+    expect(getByTestId('pass-chevron-east')).toBeTruthy();
-    expect(queryByTestId('pass-chevron-ty')).toBeNull();
+    expect(queryByTestId('pass-chevron-east')).toBeNull();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LineBoard/shared/components/LineDot.test.tsx` around lines 34
- 41, The mocked component PassChevronEast returns a View with testID
"pass-chevron-ty" which is inconsistent with the component name; update the mock
in LineDot.test.tsx so the returned View uses testID "pass-chevron-east" and
then update all corresponding test assertions that expect "pass-chevron-ty" (the
assertions around where the mock is used) to assert "pass-chevron-east" instead
so names are consistent (search for usages of testID "pass-chevron-ty" and
replace them).
🤖 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/LineBoard/shared/components/LineDot.test.tsx`:
- Around line 34-41: The mocked component PassChevronEast returns a View with
testID "pass-chevron-ty" which is inconsistent with the component name; update
the mock in LineDot.test.tsx so the returned View uses testID
"pass-chevron-east" and then update all corresponding test assertions that
expect "pass-chevron-ty" (the assertions around where the mock is used) to
assert "pass-chevron-east" instead so names are consistent (search for usages of
testID "pass-chevron-ty" and replace them).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c7f7f2eb-21a0-4ba8-bc54-5f2a44651d6d

📥 Commits

Reviewing files that changed from the base of the PR and between 1f0a7d7 and 8af179a.

📒 Files selected for processing (7)
  • src/components/LineBoard/shared/components/LineDot.test.tsx
  • src/components/LineBoard/shared/components/LineDot.tsx
  • src/components/LineBoardE231.tsx
  • src/components/LineBoardEast.tsx
  • src/components/LineBoardJO.test.tsx
  • src/components/LineBoardJO.tsx
  • src/components/PassChevronEast.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/components/LineBoard/shared/components/LineDot.test.tsx (1)

93-93: 非通過ケースは LinearGradient の直接検証を追加するとより堅牢です。

現状は pass-chevron-east の不在確認が中心なので、テスト名どおり LinearGradient 自体の存在確認も入れると回帰耐性が上がります。

♻️ 例: 検証強化差分
-    const { queryByTestId, getByTestId } = render(
+    const { queryByTestId, getByTestId, UNSAFE_getByType } = render(
       <LineDot
         station={mockStation}
         shouldGrayscale={false}
         transferLines={mockTransferLines}
         arrived={false}
         passed={false}
       />
     );

     expect(queryByTestId('pass-chevron-east')).toBeNull();
     expect(getByTestId('pad-line-marks')).toBeTruthy();
+    const LinearGradient = require('expo-linear-gradient').LinearGradient;
+    expect(UNSAFE_getByType(LinearGradient)).toBeTruthy();

As per coding guidelines "Test agents in isolation and with integration tests to ensure correctness and compatibility".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LineBoard/shared/components/LineDot.test.tsx` at line 93, The
test currently only asserts that queryByTestId('pass-chevron-east') is null;
additionally assert the absence (or presence as appropriate for the non-pass
case) of the LinearGradient element to make the test more robust: locate the
test for the LineDot component in LineDot.test.tsx and add an assertion that
queries for the LinearGradient (by its testID or component name used in
rendering) and expects it to be null in the non-pass scenario so the test
verifies the LinearGradient is not rendered alongside the chevron absence.
🤖 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/LineBoard/shared/components/LineDot.test.tsx`:
- Line 93: The test currently only asserts that
queryByTestId('pass-chevron-east') is null; additionally assert the absence (or
presence as appropriate for the non-pass case) of the LinearGradient element to
make the test more robust: locate the test for the LineDot component in
LineDot.test.tsx and add an assertion that queries for the LinearGradient (by
its testID or component name used in rendering) and expects it to be null in the
non-pass scenario so the test verifies the LinearGradient is not rendered
alongside the chevron absence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59e2102f-45d6-4695-b9a3-0e27dc4640b7

📥 Commits

Reviewing files that changed from the base of the PR and between 8af179a and 317b916.

📒 Files selected for processing (1)
  • src/components/LineBoard/shared/components/LineDot.test.tsx

@TinyKitten
TinyKitten merged commit edb7889 into dev Apr 8, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the chore/component-name-refactor branch April 8, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant