Skip to content

test: createScanAction の beforeScan ordering test 名と assertion を整合 (#236)#245

Merged
ymnao merged 1 commit into
mainfrom
feature/rename-beforescan-ordering-test-#236
Jun 27, 2026
Merged

test: createScanAction の beforeScan ordering test 名と assertion を整合 (#236)#245
ymnao merged 1 commit into
mainfrom
feature/rename-beforescan-ordering-test-#236

Conversation

@ymnao

@ymnao ymnao commented Jun 27, 2026

Copy link
Copy Markdown
Owner

概要

src/stores/createScanAction.test.ts:134 の test 名が「ordering を主張」("are applied before loading flips") しているが、assertion は最終状態 (currentKey / items / loading) のみ確認しており、ordering 自体を assert していない。test 名と実装の乖離を解消するため、test 名を最終状態 assertion 向きに rename した。

関連 Issue

closes #236

移行 Stage

該当なし (v0.7.0 milestone の quick win batch、test 整備)。

変更内容

  • src/stores/createScanAction.test.ts:134 の test 名を rename
    • Before: "beforeScan: pre-state mutations are applied before loading flips"
    • After: "beforeScan: pre-state mutations are reflected in the final state"
  • production code は無変更 (test 名 1 行のみ、+1 / -1)

採用方針 (Option A)

Issue #236 で提示された 2 案のうち Option A (test 名 rename) を採用。

  • Option A (採用): test 名を assertion 内容に合わせて rename。scope 最小、test 修正のみ
  • Option B (見送り): assertion を callOrder spy + set wrapper で ordering 確認に強化。spy 機構の追加で scope やや大きく、また現状の assertion (currentKey / items / loading が beforeScan 適用後の値で観測される) が間接的に「beforeScan の mutation が最終 state に reflect される」契約を保証しているため、ordering 自体の厳密な assert は必要性が低いと判断

動作確認

  • pnpm test src/stores/createScanAction.test.ts — 8 ケース全 pass
  • 全体 vitest — 2230 pass / 2 skip / 0 fail (98 files)
  • tsc --noEmit clean
  • biome check src/stores/createScanAction.test.ts clean

スクリーンショット

該当なし (test 名 rename のみ、UI 変更なし)。

)

- `src/stores/createScanAction.test.ts:134` の test 名が「ordering を主張」しているが、assertion は最終状態 (currentKey / items / loading) のみ確認しており、ordering 自体を assert していない。test 名と実装の乖離を解消するため、issue #236 Option A (test 名を最終状態 assertion 向きに rename) を採用
- "beforeScan: pre-state mutations are applied before loading flips"
  → "beforeScan: pre-state mutations are reflected in the final state"
- Diff: +1 / -1 (test 名のみ、production code 無変更)
- `pnpm test src/stores/createScanAction.test.ts` 8 ケース全 pass、全体 vitest 2230 pass、typecheck / biome clean
@ymnao ymnao merged commit 9420d98 into main Jun 27, 2026
15 of 16 checks passed
@ymnao ymnao deleted the feature/rename-beforescan-ordering-test-#236 branch June 27, 2026 03:27
ymnao added a commit that referenced this pull request Jun 27, 2026
* fix: electron e2e の launch fixture teardown timeout を 60s に拡大する

PR #245 の初回 CI で flaky fail した `structured-error.electron.spec.ts`
の `Tearing down "launch" exceeded the test timeout of 30000ms.` を救済する。

`launch` fixture は明示的な timeout を持たなかったため test timeout
(default 30s) と共有していた。`{ timeout: 60_000 }` を Playwright の
配列形式で明示し、teardown 単独に 60s の余裕を持たせる (test 本体の
timeout は default 30s のまま据え置きで、本体 hang の検出は従来通り維持)。

Closes #246

* refactor: launch fixture の cleanup コメント圧縮と teardown 並列化

/simplify レビューを適用:

- 5 行コメントを 2 行に圧縮 (Playwright 仕様解説は公式 doc 任せ)
- teardown の sequential `for...of + await app.close()` を
  `Promise.all` 化。再 launch test で teardown が直列で線形に
  伸びるのを抑制し、今回の timeout 拡張動機 (teardown 余裕確保)
  と整合
@ymnao ymnao mentioned this pull request Jul 5, 2026
7 tasks
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: createScanAction の beforeScan ordering test 名と assertion を整合させる

1 participant