Improve test tooling (#18259)

## Summary

Unifies test mocking tooling across Jest and Storybook, replaces
handcrafted mock data with auto-generated server-fetched data, and
restructures the mock data generation script for maintainability.

### Mock data generation

- Split `generate-mock-data.ts` into three focused modules under
`scripts/mock-data/`:
  - `utils.ts` — shared authentication, GraphQL client, and file writer
  - `generate-metadata.ts` — fetches object metadata from `/metadata`
- `generate-record-data.ts` — fetches record data from `/graphql` using
metadata-driven dynamic queries
- The orchestrator (`generate-mock-data.ts`) authenticates once and
passes the token to both generators
- Company records are now fetched from the actual server (limited to 10
records) instead of being handcrafted
- Generated files are organized under `generated/metadata/objects/` and
`generated/data/companies/`

### Unified test utilities

- Consolidated Jest and MSW mocking into shared utilities that compose
production code (`prefillRecord`, `getRecordNodeFromRecord`,
`getRecordConnectionFromRecords`) with mock metadata
- Renamed `generateEmptyJestRecordNode` → `generateMockRecordNode` and
moved to `testing/utils/`
- Extracted `generateMockRecordConnection` into its own file
- Removed `sanitizeInputForPrefill` workaround (no longer needed with
correctly shaped generated data)
This commit is contained in:
Charles Bochet
2026-02-26 14:31:54 +01:00
committed by GitHub
parent 2f0103faa5
commit 8a7a19f312
33 changed files with 23068 additions and 21543 deletions
@@ -1,784 +1,21 @@
import { type Company } from '@/companies/types/Company';
import { getRecordsFromRecordConnection } from '@/object-record/cache/utils/getRecordsFromRecordConnection';
import { type ObjectRecord } from '@/object-record/types/ObjectRecord';
import { isDefined } from 'twenty-shared/utils';
import { mockedCompanyRecords } from '~/testing/mock-data/generated/data/companies/mock-companies-data';
import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';
export const companiesQueryResult = {
companies: {
__typename: 'CompanyConnection',
totalCount: 13,
pageInfo: {
__typename: 'PageInfo',
hasNextPage: false,
startCursor:
'WzEsICIyMDIwMjAyMC0zZWMzLTRmZTMtODk5Ny1iNzZhYTBiZmE0MDgiXQ==',
endCursor: 'WzEzLCAiMjAyMDIwMjAtMTQ1NS00YzU3LWFmYWYtZGQ1ZGMwODYzNjFkIl0=',
},
edges: [
{
__typename: 'CompanyEdge',
cursor: 'WzEsICIyMDIwMjAyMC0zZWMzLTRmZTMtODk5Ny1iNzZhYTBiZmE0MDgiXQ==',
node: {
__typename: 'Company',
id: '20202020-3ec3-4fe3-8997-b76aa0bfa408',
employees: 100,
createdAt: '2025-01-05T09:00:20.412Z',
updatedAt: '2025-01-05T10:15:30.412Z',
deletedAt: null,
name: 'Linkedin',
accountOwnerId: null,
accountOwner: null,
domainName: {
__typename: 'Links',
primaryLinkLabel: 'https://linkedin.com',
primaryLinkUrl: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
position: 1,
idealCustomerProfile: true,
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
previousEmployees: {
__typename: 'Person',
id: '20202020-2d40-4e49-8df4-9c6a049191de',
email: 'louis.duss@google.com',
position: 14,
testJson: null,
testRating: null,
companyId: '20202020-c21e-4ec2-873b-de4264d89025',
avatarUrl: '',
updatedAt: '2025-01-05T11:36:42.400Z',
testMultiSelect: null,
testBoolean: true,
testSelect: 'OPTION_1',
testDateOnly: null,
bestCompanyId: null,
testUuid: null,
phone: '+33788901234',
createdAt: '2025-01-05T09:00:20.412Z',
city: 'Seattle',
testPhone: '',
jobTitle: 'CTO',
testCurrency: {
__typename: 'Currency',
amountMicros: null,
currencyCode: 'USD',
},
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'twitter.com',
},
testLinks: {
__typename: 'Links',
primaryLinkUrl: '',
primaryLinkLabel: '',
secondaryLinks: [],
},
name: {
__typename: 'FullName',
firstName: 'Louis',
lastName: 'Duss',
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: 'linkedin.com',
},
testAddress: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
testLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
},
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzIsICIyMDIwMjAyMC01ZDgxLTQ2ZDYtYmY4My1mN2ZkMzNlYTYxMDIiXQ==',
node: {
__typename: 'Company',
id: '20202020-5d81-46d6-bf83-f7fd33ea6102',
employees: null,
createdAt: '2025-01-06T08:30:15.412Z',
updatedAt: '2025-01-06T14:45:22.412Z',
deletedAt: null,
name: 'Facebook',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://facebook.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 2,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzMsICIyMDIwMjAyMC0wNzEzLTQwYTUtODIxNi04MjgwMjQwMWQzM2UiXQ==',
node: {
__typename: 'Company',
id: '20202020-0713-40a5-8216-82802401d33e',
employees: null,
createdAt: '2025-01-07T10:15:30.412Z',
updatedAt: '2025-01-07T16:20:45.412Z',
deletedAt: null,
name: 'Anthropic',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://anthropic.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 3,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzQsICIyMDIwMjAyMC1lZDg5LTQxM2EtYjMxYS05NjI5ODZlNjdiYjQiXQ==',
node: {
__typename: 'Company',
id: '20202020-ed89-413a-b31a-962986e67bb4',
employees: null,
createdAt: '2025-01-08T11:45:10.412Z',
updatedAt: '2025-01-08T17:30:25.412Z',
deletedAt: null,
name: 'Microsoft',
idealCustomerProfile: true,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://microsoft.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 4,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzUsICIyMDIwMjAyMC0xNzFlLTRiY2MtOWNmNy00MzQ0OGQ2ZmIyNzgiXQ==',
node: {
__typename: 'Company',
id: '20202020-171e-4bcc-9cf7-43448d6fb278',
employees: null,
createdAt: '2025-01-09T09:20:45.412Z',
updatedAt: '2025-01-09T15:10:30.412Z',
deletedAt: null,
name: 'Airbnb',
idealCustomerProfile: true,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://airbnb.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 5,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzYsICIyMDIwMjAyMC1jMjFlLTRlYzItODczYi1kZTQyNjRkODkwMjUiXQ==',
node: {
__typename: 'Company',
id: '20202020-c21e-4ec2-873b-de4264d89025',
employees: null,
createdAt: '2025-01-10T13:30:20.412Z',
updatedAt: '2025-01-10T18:45:35.412Z',
deletedAt: null,
name: 'Google',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://google.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 6,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzcsICIyMDIwMjAyMC03MDdlLTQ0ZGMtYTFkMi0zMDAzMGJmMWE5NDQiXQ==',
node: {
__typename: 'Company',
id: '20202020-707e-44dc-a1d2-30030bf1a944',
employees: null,
createdAt: '2025-01-11T07:15:50.412Z',
updatedAt: '2025-01-11T12:25:15.412Z',
deletedAt: null,
name: 'Netflix',
idealCustomerProfile: true,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://netflix.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 7,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzgsICIyMDIwMjAyMC0zZjc0LTQ5MmQtYTEwMS0yYTcwZjUwYTE2NDUiXQ==',
node: {
__typename: 'Company',
id: '20202020-3f74-492d-a101-2a70f50a1645',
employees: null,
createdAt: '2025-01-12T14:40:25.412Z',
updatedAt: '2025-01-12T19:55:40.412Z',
deletedAt: null,
name: 'Libeo',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://libeo.io',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 8,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzksICIyMDIwMjAyMC1jZmJmLTQxNTYtYTc5MC1lMzk4NTRkY2Q0ZWIiXQ==',
node: {
__typename: 'Company',
id: '20202020-cfbf-4156-a790-e39854dcd4eb',
employees: null,
createdAt: '2025-01-13T08:25:35.412Z',
updatedAt: '2025-01-13T13:40:50.412Z',
deletedAt: null,
name: 'Claap',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://claap.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 9,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzEwLCAiMjAyMDIwMjAtZjg2Yi00MTlmLWI3OTQtMDIzMTlhYmU4NjM3Il0=',
node: {
__typename: 'Company',
id: '20202020-f86b-419f-b794-02319abe8637',
employees: null,
createdAt: '2025-01-14T16:10:15.412Z',
updatedAt: '2025-01-14T21:30:25.412Z',
deletedAt: null,
name: 'Hasura',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://hasura.io',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 10,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzExLCAiMjAyMDIwMjAtNTUxOC00NTUzLTk0MzMtNDJkOGViODI4MzRiIl0=',
node: {
__typename: 'Company',
id: '20202020-5518-4553-9433-42d8eb82834b',
employees: null,
createdAt: '2025-01-15T12:50:40.412Z',
updatedAt: '2025-01-15T17:15:55.412Z',
deletedAt: null,
name: 'Wework',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://wework.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 11,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzEyLCAiMjAyMDIwMjAtZjc5ZS00MGRkLWJkMDYtYzM2ZTZhYmI0Njc4Il0=',
node: {
__typename: 'Company',
id: '20202020-f79e-40dd-bd06-c36e6abb4678',
employees: null,
createdAt: '2025-01-16T10:35:20.412Z',
updatedAt: '2025-01-16T15:50:35.412Z',
deletedAt: null,
name: 'Samsung',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://samsung.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 12,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
{
__typename: 'CompanyEdge',
cursor: 'WzEzLCAiMjAyMDIwMjAtMTQ1NS00YzU3LWFmYWYtZGQ1ZGMwODYzNjFkIl0=',
node: {
__typename: 'Company',
id: '20202020-1455-4c57-afaf-dd5dc086361d',
employees: null,
createdAt: '2025-01-17T11:20:10.412Z',
updatedAt: '2025-01-17T16:45:25.412Z',
deletedAt: null,
name: 'Algolia',
idealCustomerProfile: false,
accountOwner: null,
accountOwnerId: null,
domainName: {
__typename: 'Links',
primaryLinkUrl: 'https://algolia.com',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {
__typename: 'Address',
addressStreet1: '',
addressStreet2: '',
addressCity: '',
addressState: '',
addressCountry: '',
addressPostcode: '',
addressLat: null,
addressLng: null,
},
previousEmployees: null,
annualRecurringRevenue: {
__typename: 'Currency',
amountMicros: null,
currencyCode: '',
},
position: 13,
xLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
linkedinLink: {
__typename: 'Links',
primaryLinkLabel: '',
primaryLinkUrl: '',
secondaryLinks: [],
},
},
},
],
},
};
const allMockedCompanyRecords = getRecordsFromRecordConnection({
recordConnection: companiesQueryResult.companies,
}) as ObjectRecord[];
const allMockedCompanyRecords = mockedCompanyRecords as ObjectRecord[];
export const getCompaniesMock = () => {
return [...allMockedCompanyRecords] as Company[];
};
export const getCompaniesRecordConnectionMock = () => {
const companiesMock = companiesQueryResult.companies.edges.map(
(edge) => edge.node,
);
return companiesMock;
return [...allMockedCompanyRecords];
};
export const getMockCompanyObjectMetadataItem = () => {
const companyObjectMetadataItem = getMockObjectMetadataItemOrThrow('company');
return companyObjectMetadataItem;
return getMockObjectMetadataItemOrThrow('company');
};
export const getCompanyDuplicateMock = () => {
@@ -811,26 +48,3 @@ export const findMockCompanyRecord = ({
return company;
};
export const getEmptyCompanyMock = () => {
return {
id: '9231e6ee-4cc2-4c7b-8c55-dff16f4d968a',
name: '',
domainName: {
__typename: 'Links',
primaryLinkUrl: '',
primaryLinkLabel: '',
secondaryLinks: [],
},
address: {},
accountOwner: null,
createdAt: null,
updatedAt: null,
employees: null,
idealCustomerProfile: null,
linkedinLink: null,
xLink: null,
_activityCount: null,
__typename: 'Company',
};
};
@@ -1,4 +1,4 @@
import { companiesQueryResult } from '~/testing/mock-data/companies';
import { getCompaniesMock } from '~/testing/mock-data/companies';
import { mockedWorkspaceMemberData } from '~/testing/mock-data/users';
import { mockedViewsData } from '~/testing/mock-data/views';
@@ -18,8 +18,8 @@ export const mockedFavoritesData = [
workflowVersion: null,
forWorkspaceMemberId: mockedWorkspaceMemberData.id,
forWorkspaceMember: mockedWorkspaceMemberData,
companyId: companiesQueryResult.companies.edges[0].node.id,
company: companiesQueryResult.companies.edges[0].node,
companyId: getCompaniesMock()[0].id,
company: getCompaniesMock()[0],
viewId: null,
view: null,
taskId: null,
@@ -1,29 +1,10 @@
import { type RecordGqlConnection } from '@/object-record/graphql/types/RecordGqlConnection';
export const getWorkflowMock = () => {
return workflowQueryResult.workflows.edges[0].node;
};
export const getWorkflowVersionsMock = () => {
return {
...getWorkflowMock().versions,
__typename: 'WorkflowVersionConnection',
totalCount: 1,
pageInfo: {
__typename: 'PageInfo',
hasNextPage: false,
hasPreviousPage: false,
startCursor:
'eyJjcmVhdGVkQXQiOiIyMDI0LTA5LTE5VDEwOjEwOjA0LjcyNVoiLCJpZCI6ImY2MTg4NDNhLTI2YmUtNGE1NC1hNjBmLWY0Y2U4OGE1OTRmMCJ9',
endCursor:
'eyJjcmVhdGVkQXQiOiIyMDI0LTA5LTE5VDEwOjEwOjA0LjcyNVoiLCJpZCI6ImY2MTg4NDNhLTI2YmUtNGE1NC1hNjBmLWY0Y2U4OGE1OTRmMCJ9',
},
};
};
export const getWorkflowNodeIdMock = () => {
return getWorkflowMock().versions.edges[0].node.steps[0].id;
};
// Keep function wrappers as aliases for backward compatibility — they just
// return the pre-computed constants so callers can be migrated gradually.
export const getWorkflowMock = () => mockedWorkflow;
export const getWorkflowVersionsMock = () => mockedWorkflowVersions;
export const getWorkflowNodeIdMock = () => mockedWorkflowNodeId;
export const MOCKED_STEP_ID = '04d5f3bf-9714-400d-ba27-644006a5fb1b';
@@ -1552,3 +1533,24 @@ export const workflowQueryResult = {
],
},
} satisfies { workflows: RecordGqlConnection };
export const mockedWorkflow = workflowQueryResult.workflows.edges[0].node;
export const mockedWorkflowVersion = mockedWorkflow.versions.edges[0].node;
export const mockedWorkflowVersions = {
...mockedWorkflow.versions,
__typename: 'WorkflowVersionConnection' as const,
totalCount: 1,
pageInfo: {
__typename: 'PageInfo' as const,
hasNextPage: false,
hasPreviousPage: false,
startCursor:
'eyJjcmVhdGVkQXQiOiIyMDI0LTA5LTE5VDEwOjEwOjA0LjcyNVoiLCJpZCI6ImY2MTg4NDNhLTI2YmUtNGE1NC1hNjBmLWY0Y2U4OGE1OTRmMCJ9',
endCursor:
'eyJjcmVhdGVkQXQiOiIyMDI0LTA5LTE5VDEwOjEwOjA0LjcyNVoiLCJpZCI6ImY2MTg4NDNhLTI2YmUtNGE1NC1hNjBmLWY0Y2U4OGE1OTRmMCJ9',
},
};
export const mockedWorkflowNodeId = mockedWorkflowVersion.steps[0].id;