docs(ui): add stories for PDS page#2514
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughSummary by CodeRabbitTests
WalkthroughAdded a new MSW request handler for the PDS users endpoint returning mock user data with Changes
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.storybook/handlers.ts (1)
61-93: Type the mock payload asAtprotoProfile[]to prevent contract drift.Line 62 returns an untyped literal; a future field rename or removal here would not be caught against the real
/api/atproto/pds-usersshape.Proposed diff
import { http, HttpResponse } from 'msw' +import type { AtprotoProfile } from '#shared/types/atproto' + +const mockPdsUsers = [ + { + did: 'did:plc:mock0001', + handle: 'patak.dog', + displayName: 'Patak Dog', + avatar: + 'https://cdn.bsky.app/img/avatar/plain/did:plc:zjfptjaegvgc7r2axkkyyzqn/bafkreihrcqhp575f6dph4uztbeyxfrmfnbv7x2gvovrgu4idgdsdw7wety', + }, + { + did: 'did:plc:mock0002', + handle: 'patakllama.mockpmx.social', + displayName: 'Patak Llama', + avatar: 'https://api.dicebear.com/9.x/initials/svg?seed=llama', + }, + { + did: 'did:plc:mock0003', + handle: 'patak.horse', + displayName: 'Patak Horse', + avatar: + 'https://cdn.bsky.app/img/avatar/plain/did:plc:vqh7id7sddkrfkhgt7tstlpd/bafkreifodkgqszgpt2qnoyljnbafokr6eujqwztj2kxo473adv5b57hjse', + }, + { + did: 'did:plc:mock0004', + handle: 'patakcatapiller.mockpmx.social', + }, + { + did: 'did:plc:mock0005', + handle: 'patakgoat.mockpmx.social', + displayName: 'Patak Goat', + }, +] satisfies AtprotoProfile[] export const pdsUsersHandler = http.get('/api/atproto/pds-users', () => { - return HttpResponse.json([ - { - did: 'did:plc:mock0001', - handle: 'patak.dog', - displayName: 'Patak Dog', - avatar: - 'https://cdn.bsky.app/img/avatar/plain/did:plc:zjfptjaegvgc7r2axkkyyzqn/bafkreihrcqhp575f6dph4uztbeyxfrmfnbv7x2gvovrgu4idgdsdw7wety', - }, - { - did: 'did:plc:mock0002', - handle: 'patakllama.mockpmx.social', - displayName: 'Patak Llama', - avatar: 'https://api.dicebear.com/9.x/initials/svg?seed=llama', - }, - { - did: 'did:plc:mock0003', - handle: 'patak.horse', - displayName: 'Patak Horse', - avatar: - 'https://cdn.bsky.app/img/avatar/plain/did:plc:vqh7id7sddkrfkhgt7tstlpd/bafkreifodkgqszgpt2qnoyljnbafokr6eujqwztj2kxo473adv5b57hjse', - }, - { - did: 'did:plc:mock0004', - handle: 'patakcatapiller.mockpmx.social', - }, - { - did: 'did:plc:mock0005', - handle: 'patakgoat.mockpmx.social', - displayName: 'Patak Goat', - }, - ]) + return HttpResponse.json(mockPdsUsers) })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.storybook/handlers.ts around lines 61 - 93, The mock response in pdsUsersHandler is currently an untyped literal which can drift from the real API contract; update the handler to explicitly type the returned payload as AtprotoProfile[] (e.g., annotate the HttpResponse.json generic or the array variable with AtprotoProfile[]) and import the AtprotoProfile type where needed so TypeScript will validate the mock shape against the real profile interface in pdsUsersHandler.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.storybook/handlers.ts:
- Around line 61-93: The mock response in pdsUsersHandler is currently an
untyped literal which can drift from the real API contract; update the handler
to explicitly type the returned payload as AtprotoProfile[] (e.g., annotate the
HttpResponse.json generic or the array variable with AtprotoProfile[]) and
import the AtprotoProfile type where needed so TypeScript will validate the mock
shape against the real profile interface in pdsUsersHandler.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 75457279-3e54-4a00-bc06-25ac0ffb8910
📒 Files selected for processing (2)
.storybook/handlers.tsapp/pages/pds.stories.ts
🔗 Linked issue
#2150
🧭 Context
This would enable a storybook mock page, storybook a11y checks, and chromatic visual regression tests for this page as documented by the storybook stories.
📚 Description
Adds stories for PDS page and MSW
pdsUserHandlerfor mocking pds-users API.