Skip to content

Commit caedfa9

Browse files
river0525claude
andcommitted
fix: address CodeRabbit round 3 findings
- VotableGrade.svelte: remove @ts-expect-error; append ?tab=atcoder after resolve() - e2e/votes.spec.ts: add clarifying comment on intentional voteForm visibility check - .claude/rules/testing.md: rename cleanup subsection to "Integration Tests and Tests with Real Side Effects"; add note that it does not apply to Prisma-mock unit tests Skip: locals.user?.is_validated -> session.user (session.user type lacks is_validated) Skip: sitemap.xml /votes/[slug] exclusion (defensive pattern, not harmful) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 83d58c3 commit caedfa9

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

.claude/rules/testing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ function mockCount(value: number) {
103103

104104
Extract `mockFindUnique`, `mockFindMany`, and `mockCount` as the standard trio for service tests that touch a single Prisma model. Add `mockCreate`, `mockTransaction`, and `mockDelete` when those operations are also tested.
105105

106-
### Cleanup for Tests with Real Side Effects
106+
### Cleanup for Integration Tests and Tests with Real Side Effects
107+
108+
This does not apply to standard service layer unit tests that use Prisma mocks.
107109

108110
If a test performs real DB mutations, file system changes, external API calls, or other stateful side effects that persist beyond the test (e.g., integration tests, seed scripts), wrap assertions in `try/finally` — a failing assertion skips cleanup and contaminates later tests:
109111

e2e/votes.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ test.describe('vote detail page (/votes/[slug])', () => {
131131
const isUnverified = await unverifiedMessage.isVisible();
132132
test.skip(isUnverified, 'test user is not AtCoder-verified');
133133

134-
// Vote form with grade buttons is rendered for logged-in verified users
134+
// Explicit check: voteForm is already guaranteed visible by the or() wait above,
135+
// but this documents the expected state for verified users.
135136
await expect(voteForm).toBeVisible({
136137
timeout: TIMEOUT,
137138
});

src/features/votes/components/VotableGrade.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
// Use task_id as a deterministic component ID to avoid SSR/hydration mismatches.
3838
const componentId = taskResult.task_id;
3939
40-
// @ts-expect-error svelte-check TS2554: AppTypes declaration merging causes RouteId to resolve as string, requiring params. Runtime behavior is correct.
41-
const editProfileHref = resolve(EDIT_PROFILE_PAGE + '?tab=atcoder');
40+
const editProfileHref = `${resolve(EDIT_PROFILE_PAGE)}?tab=atcoder`;
4241
4342
let selectedVoteGrade = $state<TaskGrade>();
4443
let showForm = $state(false);

0 commit comments

Comments
 (0)