Conversation
Greptile SummaryThis PR systematically migrates the test infrastructure from manually maintained mock data to auto-generated mock data fetched from a real backend, improving maintainability and reducing drift between test data and production schemas. Key Changes:
Benefits:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: cf1a432 |
There was a problem hiding this comment.
Pull request overview
This PR migrates hand-written test mock data files to auto-generated equivalents derived from a real Twenty instance. It removes the maintenance burden of manually kept mock data and ensures consistency with actual server responses.
Changes:
- Removes 9 hand-written mock files (
workspace-members.ts,views.ts,view-fields.ts,favorite.ts,connected-accounts.ts,companiesWithRelations.ts,calendar.ts,api-keys.ts,accounts.ts) and introduces new auto-generated files undersrc/testing/mock-data/generated/ - Adds generator scripts for views, billing plans, API keys, workspace members, favorites, connected accounts, and calendar events
- Updates 16 test/story files to consume the new generated mock data, and fixes the
WorkflowEditActionEmailBasestory assertion to match the new mock recipient email
Reviewed changes
Copilot reviewed 29 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
workspace-members.ts |
Deleted; replaced by mock-workspaceMembers-data.ts |
views.ts |
Deleted; replaced by mock-views-data.ts |
view-fields.ts |
Deleted; view fields are now embedded in each view in mock-views-data.ts |
favorite.ts |
Deleted; replaced by mock-favorites-data.ts |
connected-accounts.ts |
Deleted; replaced by mock-connectedAccounts-data.ts |
companiesWithRelations.ts |
Deleted; replaced by mock-companies-data.ts |
calendar.ts |
Deleted; replaced by mock-calendarEvents-data.ts |
api-keys.ts |
Deleted; replaced by mock-api-keys-data.ts |
accounts.ts |
Deleted; replaced by mock-connectedAccounts-data.ts |
mock-api-keys-data.ts |
New generated file with 1 API key |
mock-favorites-data.ts |
New generated file with 10 favorite records |
mock-favoriteFolders-data.ts |
New generated file (empty array) |
mock-connectedAccounts-data.ts |
New generated file with 3 connected accounts |
mock-calendarEvents-data.ts |
New generated file with 10 calendar events |
mock-roles-data.ts |
Minor field-order change in last entry |
graphqlMocks.ts |
Switches to generated data for views, workspace members, favorites, and API keys |
RecordTableDecorator.tsx |
Uses generated mockedCoreViews instead of old mockedViewsData |
ObjectMetadataItemsDecorator.tsx |
Uses generated workspace members for current workspace member |
WorkflowEditActionEmailBase.stories.tsx |
Switches to generated connected accounts; fixes email assertion |
useApplyCurrentViewSorts/Filters/FilterGroups.test.tsx |
Switch to generated views |
ViewBarFilterDropdown.stories.tsx, RecordCalendarMonth.stories.tsx, RecordTable.stories.tsx |
Switch to generated views |
useDeleteOneObjectMetadataItem.test.tsx, useDeleteOneRecord.test.tsx |
Switch to generated data |
computeOptimisticRecordFromInput.test.ts, useActivityTargetObjectRecords.test.tsx |
Switch to generated workspace members |
useDeleteOneRecord.test.tsx.snap |
Updated snapshots to match new generated company data |
generate-views.ts, generate-billing-plans.ts, generate-api-keys.ts |
New generator scripts |
generate-record-data.ts |
Adds new object types to generate |
generate-mock-data.ts |
Registers new generators in the main script |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| connectedAccountId: mockedConnectedAccountRecords[0] | ||
| .accountOwnerId as string, |
There was a problem hiding this comment.
The connectedAccountId field in CONFIGURED_SEND_EMAIL_ACTION is set to mockedConnectedAccountRecords[0].accountOwnerId, which is the workspace member's ID ("20202020-77d5-4cb6-b60a-f4a835a85d61"), not the connected account's own id ("20202020-0cc8-4d60-a3a4-803245698908"). The connectedAccountId field should reference the connected account record itself. The WorkflowEditActionEmailBase component uses connectedAccountId to match against account.id (see accounts.find((account) => account.id === formData.connectedAccountId)), so this mismatch means the "Configured" story will fail to find and display the selected account, making the story misleading. It should use mockedConnectedAccountRecords[0].id as string.
| connectedAccountId: mockedConnectedAccountRecords[0] | |
| .accountOwnerId as string, | |
| connectedAccountId: mockedConnectedAccountRecords[0].id as string, |
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:53445 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
Hey @charlesBochet! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
Summary
Test plan