feat: コンテンツAPI POSTとPUTで isClosed オプションをつけると公開終了ステータスで登録できる#101
feat: コンテンツAPI POSTとPUTで isClosed オプションをつけると公開終了ステータスで登録できる#101
isClosed オプションをつけると公開終了ステータスで登録できる#101Conversation
…aft and isClosed combination.
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/createClient.test.ts (1)
262-313: PUT パス(contentId指定時)のisClosedもテスト追加したいです。現状は POST のみ検証されています。PR目的どおりにするなら、
contentIdありのときにstatus=closedが付与され、メソッドが PUT になるケースも1本あると安心です。✅ 追加テスト例
+ test('Sends `status=closed` with PUT when `contentId` is specified', async () => { + let requestUrl = ''; + let requestMethod = ''; + server.use( + http.put(`${testBaseUrl}/list-type/foo`, ({ request }) => { + requestUrl = request.url; + requestMethod = request.method; + return HttpResponse.json({ id: 'foo' }); + }), + ); + + await client.create({ + endpoint: 'list-type', + contentId: 'foo', + content: { title: 'test' }, + isClosed: true, + }); + + expect(requestMethod).toBe('PUT'); + expect(new URL(requestUrl).searchParams.get('status')).toBe('closed'); + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/createClient.test.ts` around lines 262 - 313, Add a new test that calls client.create with a contentId (to force a PUT) and isClosed: true, capture the incoming request in the mock handler, and assert that request.method is "PUT" and new URL(request.url).searchParams.get('status') === 'closed'; use the same pattern as the existing tests (server.use(http.post/handler) but change to http.put or capture method from the request) and reference client.create, the endpoint 'list-type', and the contentId property to locate where to add the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 347-382: The README examples for client.create (the "Create closed
content" and "Create closed content with specified ID" sections) lack the
constraint that isDraft and isClosed cannot be set simultaneously; add a clear
note near those sections stating that the properties isDraft and isClosed are
mutually exclusive and passing both as true will cause a runtime error, and
update or annotate the example calls (the client.create usage) to either
explicitly show only isClosed or to include a short remark that isDraft must be
false/omitted when isClosed is true.
---
Nitpick comments:
In `@tests/createClient.test.ts`:
- Around line 262-313: Add a new test that calls client.create with a contentId
(to force a PUT) and isClosed: true, capture the incoming request in the mock
handler, and assert that request.method is "PUT" and new
URL(request.url).searchParams.get('status') === 'closed'; use the same pattern
as the existing tests (server.use(http.post/handler) but change to http.put or
capture method from the request) and reference client.create, the endpoint
'list-type', and the contentId property to locate where to add the test.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b9413f32-f6fc-47eb-94e4-ebf442f79a5a
📒 Files selected for processing (5)
README.mdREADME_jp.mdsrc/createClient.tssrc/types.tstests/createClient.test.ts
isClosedオプションを追加isClosedとisDraftが両方とも立っている場合はエラーとするSummary by CodeRabbit
新機能
ドキュメント
テスト