Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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 (2)
✅ Files skipped from review due to trivial changes (2)
Walkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/vercel-basic-auth/src/index.test.ts (1)
75-111: 認証スキーム不一致(Bearerなど)の拒否ケースも追加したいです。
Authorizationの値検証として、Basic以外のスキームを 401 にするテストを追加すると回帰検知が強くなります。追加例
describe("認証ヘッダーのバリデーション", () => { + it("Authorization スキームが Basic 以外のとき 401 を返す", () => { + const req = makeRequest(`Bearer ${btoa(`${USERNAME}:${PASSWORD}`)}`); + const res = basicAuth(req, { username: USERNAME, password: PASSWORD }); + expect(res?.status).toBe(401); + }); + it("Authorization ヘッダーなしのとき 401 を返す", () => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/vercel-basic-auth/src/index.test.ts` around lines 75 - 111, Add a new test case that verifies basicAuth rejects non-"Basic" schemes (e.g., "Bearer abc123") by returning 401 and setting WWW-Authenticate to "Basic"; create a request using makeRequest("Bearer abc123") (or similar) and call basicAuth(req, { username: USERNAME, password: PASSWORD }) and assert res?.status === 401 and res?.headers.get("WWW-Authenticate") === "Basic" to ensure scheme mismatch is covered alongside the existing makeBasicAuthHeader/USERNAME/PASSWORD tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/vercel-basic-auth/src/index.test.ts`:
- Around line 20-24: The afterEach currently deletes process.env.NODE_ENV,
process.env.VERCEL and process.env.VERCEL_ENV which can break other tests;
instead capture their original values before tests run (e.g. in a beforeEach or
at top of the test file) and restore them in afterEach by assigning back the
saved values (use undefined-check to delete only if originally undefined).
Update the afterEach handler and add a snapshot variable (e.g. originalNodeEnv,
originalVercel, originalVercelEnv) to perform safe restoration rather than
unconditional deletion.
---
Nitpick comments:
In `@packages/vercel-basic-auth/src/index.test.ts`:
- Around line 75-111: Add a new test case that verifies basicAuth rejects
non-"Basic" schemes (e.g., "Bearer abc123") by returning 401 and setting
WWW-Authenticate to "Basic"; create a request using makeRequest("Bearer abc123")
(or similar) and call basicAuth(req, { username: USERNAME, password: PASSWORD })
and assert res?.status === 401 and res?.headers.get("WWW-Authenticate") ===
"Basic" to ensure scheme mismatch is covered alongside the existing
makeBasicAuthHeader/USERNAME/PASSWORD tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 46a16055-b0be-484c-b5ce-b691231dd422
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/vercel-basic-auth/package.jsonpackages/vercel-basic-auth/src/index.test.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
概要
vercel-basic-authパッケージに vitest を使ったテストを追加します。test/test:runスクリプトを追加src/index.test.tsを作成し、12テストケースを実装NODE_ENV=development時の挙動 (devオプション)VERCEL=1) でのvercelEnvTarget各パターンformat-check.ymlからci.ymlに統合し、テストを追加Closes #17
Summary by CodeRabbit
Tests
Chores