Fix more tests 2 (#18293)
## Summary - Migrate more hand-written test mocks to auto-generated data from a real Twenty instance - Add generators for views, billing plans, API keys; extend record generator for workspace members, favorites, connected accounts, calendar events - Remove 9 hand-written mock files replaced by generated equivalents - Update 16 test/story files to use generated data - Fix WorkflowEditActionEmailBase story assertion to match configured recipient email ## Test plan - [x] Lint, typecheck, unit tests pass - [ ] Storybook tests pass in CI
This commit is contained in:
+16
-7
@@ -13,10 +13,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import {
|
||||
getMockedConnectedAccount,
|
||||
mockedConnectedAccounts,
|
||||
} from '~/testing/mock-data/connected-accounts';
|
||||
import { mockedConnectedAccountRecords } from '~/testing/mock-data/generated/data/connectedAccounts/mock-connectedAccounts-data';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
|
||||
const DEFAULT_SEND_EMAIL_ACTION: WorkflowSendEmailAction = {
|
||||
@@ -55,7 +52,8 @@ const CONFIGURED_SEND_EMAIL_ACTION: WorkflowSendEmailAction = {
|
||||
valid: true,
|
||||
settings: {
|
||||
input: {
|
||||
connectedAccountId: mockedConnectedAccounts[0].accountOwnerId,
|
||||
connectedAccountId: mockedConnectedAccountRecords[0]
|
||||
.accountOwnerId as string,
|
||||
recipients: {
|
||||
to: 'test@twenty.com',
|
||||
cc: '',
|
||||
@@ -116,7 +114,18 @@ const meta: Meta<typeof WorkflowEditActionEmailBase> = {
|
||||
graphql.query('FindManyConnectedAccounts', () => {
|
||||
return HttpResponse.json({
|
||||
data: {
|
||||
connectedAccounts: getMockedConnectedAccount(),
|
||||
connectedAccounts: {
|
||||
edges: mockedConnectedAccountRecords.map((record) => ({
|
||||
node: record,
|
||||
cursor: record.id,
|
||||
})),
|
||||
pageInfo: {
|
||||
hasNextPage: false,
|
||||
hasPreviousPage: false,
|
||||
startCursor: null,
|
||||
endCursor: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}),
|
||||
@@ -171,7 +180,7 @@ export const Configured: Story = {
|
||||
expect(await canvas.findByText('Account')).toBeVisible();
|
||||
expect(await canvas.findByText('To')).toBeVisible();
|
||||
|
||||
const emailInput = await canvas.findByText('tim@twenty.com');
|
||||
const emailInput = await canvas.findByText('test@twenty.com');
|
||||
expect(emailInput).toBeVisible();
|
||||
|
||||
const subjectInput = await canvas.findByText('Welcome to Twenty!');
|
||||
|
||||
Reference in New Issue
Block a user