Fix Frontend modules tests (#2688)

* Fix naming issue

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix more tests

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Revert unnecessary changes

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Refactor according to self-review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix graphql mocks not working anymore

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
gitstart-twenty
2023-11-29 04:18:34 +05:45
committed by GitHub
parent fd969de311
commit 0fa55b0634
25 changed files with 693 additions and 313 deletions

View File

@ -5,6 +5,7 @@ import { TaskGroups } from '@/activities/tasks/components/TaskGroups';
import { ObjectFilterDropdownScope } from '@/ui/object/object-filter-dropdown/scopes/ObjectFilterDropdownScope';
import { ComponentWithRecoilScopeDecorator } from '~/testing/decorators/ComponentWithRecoilScopeDecorator';
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { mockedTasks } from '~/testing/mock-data/activities';
@ -19,6 +20,7 @@ const meta: Meta<typeof TaskGroups> = {
),
ComponentWithRouterDecorator,
ComponentWithRecoilScopeDecorator,
SnackBarDecorator,
],
parameters: {
msw: graphqlMocks,

View File

@ -3,6 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
import { TaskList } from '@/activities/tasks/components/TaskList';
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { mockedActivities } from '~/testing/mock-data/activities';
@ -16,6 +17,7 @@ const meta: Meta<typeof TaskList> = {
</MemoryRouter>
),
ComponentDecorator,
SnackBarDecorator,
],
args: {
title: 'Tasks',

View File

@ -77,7 +77,7 @@ export const TaskRow = ({
const { completeTask } = useCompleteTask(task);
const activityTargetIds =
task?.activityTargets?.edges.map(
task?.activityTargets?.edges?.map(
(activityTarget) => activityTarget.node.id,
) ?? [];

View File

@ -7,6 +7,8 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CommandType } from '@/command-menu/types/Command';
import { IconCheckbox, IconNotes } from '@/ui/display/icon';
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { sleep } from '~/testing/sleep';
@ -18,6 +20,7 @@ const meta: Meta<typeof CommandMenu> = {
title: 'Modules/CommandMenu/CommandMenu',
component: CommandMenu,
decorators: [
ObjectMetadataItemsDecorator,
ComponentWithRouterDecorator,
(Story) => {
const { addToCommandMenu, setToIntitialCommandMenu, toggleCommandMenu } =
@ -48,6 +51,7 @@ const meta: Meta<typeof CommandMenu> = {
return <Story />;
},
SnackBarDecorator,
],
parameters: {
msw: graphqlMocks,

View File

@ -1,4 +1,4 @@
import { useRecoilState, useSetRecoilState } from 'recoil';
import { useRecoilCallback, useSetRecoilState } from 'recoil';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
@ -9,9 +9,7 @@ import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
import { Command } from '../types/Command';
export const useCommandMenu = () => {
const [isCommandMenuOpened, setIsCommandMenuOpened] = useRecoilState(
isCommandMenuOpenedState,
);
const setIsCommandMenuOpened = useSetRecoilState(isCommandMenuOpenedState);
const setCommands = useSetRecoilState(commandMenuCommandsState);
const {
setHotkeyScopeAndMemorizePreviousScope,
@ -28,13 +26,17 @@ export const useCommandMenu = () => {
goBackToPreviousHotkeyScope();
};
const toggleCommandMenu = () => {
const toggleCommandMenu = useRecoilCallback(({ snapshot }) => async () => {
const isCommandMenuOpened = snapshot
.getLoadable(isCommandMenuOpenedState)
.getValue();
if (isCommandMenuOpened) {
closeCommandMenu();
} else {
openCommandMenu();
}
};
});
const addToCommandMenu = (addCommand: Command[]) => {
setCommands((prev) => [...prev, ...addCommand]);

View File

@ -1,6 +1,7 @@
import { Meta, StoryObj } from '@storybook/react';
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { CompanyBoard } from '../board/components/CompanyBoard';
@ -16,6 +17,7 @@ const meta: Meta<typeof CompanyBoard> = {
</CompanyBoardRecoilScopeContext.Provider>
),
ComponentWithRouterDecorator,
SnackBarDecorator,
],
parameters: {
msw: graphqlMocks,

View File

@ -10,9 +10,11 @@ export const ObjectMetadataItemsProvider = ({
return loading ? (
<></>
) : (
<RelationPickerScope relationPickerScopeId="relation-picker">
<>
<ObjectMetadataItemsRelationPickerEffect />
{children}
</RelationPickerScope>
<RelationPickerScope relationPickerScopeId="relation-picker">
{children}
</RelationPickerScope>
</>
);
};

View File

@ -5,7 +5,9 @@ import { IdentifiersMapper } from '@/ui/input/components/internal/relation-picke
import { getLogoUrlFromDomainName } from '~/utils';
export const ObjectMetadataItemsRelationPickerEffect = () => {
const { setIdentifiersMapper, setSearchQuery } = useRelationPicker();
const { setIdentifiersMapper, setSearchQuery } = useRelationPicker({
relationPickerScopeId: 'relation-picker',
});
const computeFilterFields = (relationPickerType: string) => {
if (relationPickerType === 'company') {

View File

@ -18,7 +18,6 @@ export const objectMetadataItemFamilySelector = selectorFamily<
}) =>
({ get }) => {
const objectMetadataItems = get(objectMetadataItemsState);
return (
objectMetadataItems.find(
(objectMetadataItem) =>

View File

@ -69,7 +69,7 @@ export const SettingsObjectFieldTypeSelectSection = ({
description="The field's type and values."
/>
<Select
disabled={!!fieldMetadata.id}
disabled={!!fieldMetadata?.id}
dropdownScopeId="object-field-type-select"
value={values?.type}
onChange={(value) => onChange({ type: value })}

View File

@ -14,7 +14,6 @@ import {
mockedCompaniesMetadata,
mockedPeopleMetadata,
} from '~/testing/mock-data/metadata';
import { sleep } from '~/testing/sleep';
import { SettingsObjectFieldTypeSelectSection } from '../SettingsObjectFieldTypeSelectSection';
@ -61,9 +60,10 @@ export const WithOpenSelect: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await sleep(500);
const input = await canvas.findByText('Unique ID');
await userEvent.click(input);
const selectLabel = canvas.getByText('Text');
const selectLabel = canvas.getByText('Number');
await userEvent.click(selectLabel);
},

View File

@ -5,6 +5,7 @@ import { Providers } from '@/spreadsheet-import/components/Providers';
import { MatchColumnsStep } from '@/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep';
import { mockRsiValues } from '@/spreadsheet-import/tests/mockRsiValues';
import { DialogManagerScope } from '@/ui/feedback/dialog-manager/scopes/DialogManagerScope';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
const meta: Meta<typeof MatchColumnsStep> = {
title: 'Modules/SpreadsheetImport/MatchColumnsStep',
@ -12,6 +13,7 @@ const meta: Meta<typeof MatchColumnsStep> = {
parameters: {
layout: 'fullscreen',
},
decorators: [SnackBarDecorator],
};
export default meta;

View File

@ -5,6 +5,7 @@ import { Providers } from '@/spreadsheet-import/components/Providers';
import { UploadStep } from '@/spreadsheet-import/steps/components/UploadStep/UploadStep';
import { mockRsiValues } from '@/spreadsheet-import/tests/mockRsiValues';
import { DialogManagerScope } from '@/ui/feedback/dialog-manager/scopes/DialogManagerScope';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
const meta: Meta<typeof UploadStep> = {
title: 'Modules/SpreadsheetImport/UploadStep',
@ -12,6 +13,7 @@ const meta: Meta<typeof UploadStep> = {
parameters: {
layout: 'fullscreen',
},
decorators: [SnackBarDecorator],
};
export default meta;

View File

@ -11,6 +11,7 @@ import {
IconUser,
} from '@/ui/display/icon';
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import MainNavbar from '../MainNavbar';
import NavItem from '../NavItem';
@ -19,6 +20,7 @@ import NavTitle from '../NavTitle';
const meta: Meta<typeof MainNavbar> = {
title: 'UI/Navigation/Navbar/MainNavbar',
component: MainNavbar,
decorators: [SnackBarDecorator],
};
export default meta;

View File

@ -29,11 +29,12 @@ const meta: Meta = {
fieldDefinition: {
fieldMetadataId: 'phone',
label: 'Phone',
type: 'PHONE',
type: 'TEXT',
iconName: 'IconPhone',
metadata: {
fieldName: 'Phone',
fieldName: 'phone',
placeHolder: 'Phone',
objectMetadataNameSingular: 'person',
},
},
hotkeyScope: 'hotkey-scope',

View File

@ -45,11 +45,12 @@ const PhoneFieldInputWithContext = ({
fieldDefinition={{
fieldMetadataId: 'phone',
label: 'Phone',
type: 'PHONE',
type: 'TEXT',
iconName: 'IconPhone',
metadata: {
fieldName: 'Phone',
fieldName: 'phone',
placeHolder: 'Enter phone number',
objectMetadataNameSingular: 'person',
},
}}
entityId={entityId}

View File

@ -3,6 +3,7 @@ import { expect, jest } from '@storybook/jest';
import { Decorator, Meta, StoryObj } from '@storybook/react';
import { userEvent, waitFor, within } from '@storybook/testing-library';
import { RelationPickerScope } from '@/ui/input/components/internal/relation-picker/scopes/RelationPickerScope';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
import { ComponentWithRecoilScopeDecorator } from '~/testing/decorators/ComponentWithRecoilScopeDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
@ -43,21 +44,23 @@ const RelationFieldInputWithContext = ({
return (
<div>
<FieldContextProvider
fieldDefinition={{
fieldMetadataId: 'relation',
label: 'Relation',
type: 'RELATION',
iconName: 'IconLink',
metadata: {
fieldName: 'Relation',
},
}}
entityId={entityId}
>
<RelationFieldValueSetterEffect value={value} />
<RelationFieldInput onSubmit={onSubmit} onCancel={onCancel} />
</FieldContextProvider>
<RelationPickerScope relationPickerScopeId="relation-picker">
<FieldContextProvider
fieldDefinition={{
fieldMetadataId: 'relation',
label: 'Relation',
type: 'RELATION',
iconName: 'IconLink',
metadata: {
fieldName: 'Relation',
},
}}
entityId={entityId}
>
<RelationFieldValueSetterEffect value={value} />
<RelationFieldInput onSubmit={onSubmit} onCancel={onCancel} />
</FieldContextProvider>
</RelationPickerScope>
<div data-testid="data-field-input-click-outside-div" />
</div>
);
@ -108,6 +111,7 @@ export const Submit: Story = {
expect(submitJestFn).toHaveBeenCalledTimes(0);
// FIXME: Failing because the picker is not fetching any items
const item = await canvas.findByText('Jane Doe');
userEvent.click(item);

View File

@ -12,10 +12,6 @@ export type FieldType =
| 'NUMBER'
| 'PHONE'
| 'PROBABILITY'
| 'RELATION'
| 'TEXT'
| 'URL'
| 'PHONE'
| 'URL'
| 'LINK'
| 'CURRENCY'

View File

@ -0,0 +1,9 @@
import { Decorator } from '@storybook/react';
import { ObjectMetadataItemsProvider } from '@/object-metadata/components/ObjectMetadataItemsProvider';
export const ObjectMetadataItemsDecorator: Decorator = (Story) => (
<ObjectMetadataItemsProvider>
<Story />
</ObjectMetadataItemsProvider>
);

View File

@ -5,6 +5,7 @@ import { CREATE_EVENT } from '@/analytics/graphql/queries/createEvent';
import { GET_CLIENT_CONFIG } from '@/client-config/graphql/queries/getClientConfig';
import { FIND_MANY_METADATA_OBJECTS } from '@/object-metadata/graphql/queries';
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
import { mockedActivities } from '~/testing/mock-data/activities';
import { mockedCompaniesData } from './mock-data/companies';
import { mockedObjectMetadataItems } from './mock-data/metadata';
@ -17,128 +18,151 @@ const metadataGraphql = graphql.link(
`${process.env.REACT_APP_SERVER_BASE_URL}/metadata`,
);
export const graphqlMocks = [
graphql.query(getOperationName(GET_CURRENT_USER) ?? '', (req, res, ctx) => {
return res(
ctx.data({
currentUser: mockedUsersData[0],
}),
);
}),
graphql.mutation(getOperationName(CREATE_EVENT) ?? '', (req, res, ctx) => {
return res(
ctx.data({
createEvent: { success: 1, __typename: 'Event' },
}),
);
}),
graphql.query(getOperationName(GET_CLIENT_CONFIG) ?? '', (req, res, ctx) => {
return res(
ctx.data({
clientConfig: {
signInPrefilled: true,
dataModelSettingsEnabled: true,
developersSettingsEnabled: true,
debugMode: false,
authProviders: { google: true, password: true, magicLink: false },
telemetry: { enabled: false, anonymizationEnabled: true },
support: {
supportDriver: 'front',
supportFrontChatId: null,
},
},
}),
);
}),
metadataGraphql.query(
getOperationName(FIND_MANY_METADATA_OBJECTS) ?? '',
(req, res, ctx) => {
return res(ctx.data({ objects: mockedObjectMetadataItems }));
},
),
graphql.query('FindManyViews', (req, res, ctx) => {
const objectMetadataId = req.variables.filter.objectMetadataId.eq;
const viewType = req.variables.filter.type.eq;
export const graphqlMocks = {
handlers: [
graphql.query(getOperationName(GET_CURRENT_USER) ?? '', (req, res, ctx) => {
return res(
ctx.data({
currentUser: mockedUsersData[0],
}),
);
}),
graphql.mutation(getOperationName(CREATE_EVENT) ?? '', (req, res, ctx) => {
return res(
ctx.data({
createEvent: { success: 1, __typename: 'Event' },
}),
);
}),
graphql.query(
getOperationName(GET_CLIENT_CONFIG) ?? '',
(req, res, ctx) => {
return res(
ctx.data({
clientConfig: {
signInPrefilled: true,
dataModelSettingsEnabled: true,
developersSettingsEnabled: true,
debugMode: false,
authProviders: { google: true, password: true, magicLink: false },
telemetry: { enabled: false, anonymizationEnabled: true },
support: {
supportDriver: 'front',
supportFrontChatId: null,
},
},
}),
);
},
),
metadataGraphql.query(
getOperationName(FIND_MANY_METADATA_OBJECTS) ?? '',
(req, res, ctx) => {
return res(ctx.data({ objects: mockedObjectMetadataItems }));
},
),
graphql.query('FindManyViews', (req, res, ctx) => {
const objectMetadataId = req.variables.filter.objectMetadataId.eq;
const viewType = req.variables.filter.type.eq;
return res(
ctx.data({
views: {
edges: mockedViewsData
.filter(
(view) =>
view.objectMetadataId === objectMetadataId &&
view.type === viewType,
)
.map((view) => ({
node: view,
return res(
ctx.data({
views: {
edges: mockedViewsData
.filter(
(view) =>
view.objectMetadataId === objectMetadataId &&
view.type === viewType,
)
.map((view) => ({
node: view,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
}),
);
}),
graphql.query('FindManyViewFields', (req, res, ctx) => {
const viewId = req.variables.filter.view.eq;
return res(
ctx.data({
viewFields: {
edges: mockedViewFieldsData
.filter((viewField) => viewField.viewId === viewId)
.map((viewField) => ({
node: viewField,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
}),
);
}),
graphql.query('FindManyCompanies', (req, res, ctx) => {
return res(
ctx.data({
companies: {
edges: mockedCompaniesData.map((company) => ({
node: company,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
}),
);
}),
graphql.query('FindManyViewFields', (req, res, ctx) => {
const viewId = req.variables.filter.view.eq;
return res(
ctx.data({
viewFields: {
edges: mockedViewFieldsData
.filter((viewField) => viewField.viewId === viewId)
.map((viewField) => ({
node: viewField,
}),
);
}),
graphql.query('FindManyPeople', (req, res, ctx) => {
return res(
ctx.data({
people: {
edges: mockedPeopleData.map((person) => ({
node: person,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
}),
);
}),
graphql.query('FindManyCompanies', (req, res, ctx) => {
return res(
ctx.data({
companies: {
edges: mockedCompaniesData.map((company) => ({
node: company,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
}),
);
}),
graphql.query('FindManyActivities', (req, res, ctx) => {
return res(
ctx.data({
activities: {
edges: mockedActivities.map((activities) => ({
node: activities,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
},
}),
);
}),
graphql.query('FindManyPeople', (req, res, ctx) => {
return res(
ctx.data({
people: {
edges: mockedPeopleData.map((person) => ({
node: person,
cursor: null,
})),
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
},
}),
);
}),
];
}),
);
}),
],
};

View File

@ -5,34 +5,245 @@ import {
export const mockedPeopleMetadata = {
node: {
id: 'e3802178-cfe8-4df1-8be6-b1b26ba10a21',
dataSourceId: '',
__typename: 'object',
id: '20202020-c64b-44bc-bd2c-502c99f49dca',
nameSingular: 'person',
namePlural: 'people',
labelSingular: 'Person',
labelPlural: 'People',
description: null,
description: 'A person',
icon: 'IconUser',
isCustom: false,
isActive: true,
createdAt: '',
updatedAt: '',
isSystem: false,
createdAt: '2023-11-24T03:29:18.207Z',
updatedAt: '2023-11-24T03:29:18.207Z',
fields: {
edges: [
{
node: {
id: '86b696ea-9b43-46b4-9162-e1ee8b558a38',
type: FieldMetadataType.Text,
__typename: 'field',
id: '20202020-2bf4-42b8-8718-a3e852bfa6a6',
type: 'DATE_TIME',
name: 'updatedAt',
label: 'Update date',
description: null,
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-03cd-4cd0-9afc-92077b69f24f',
type: 'UUID',
name: 'id',
label: 'Id',
description: null,
icon: null,
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-486f-45f9-bbdf-aac18b1831c0',
type: 'TEXT',
name: 'phone',
label: 'Phone',
description: 'Contacts phone number',
icon: 'IconPhone',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-dcf6-445a-b543-37e55de43c25',
type: 'LINK',
name: 'linkedinLink',
label: 'Linkedin',
description: 'Contacts Linkedin account',
icon: 'IconBrandLinkedin',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-64e1-4080-b6ad-db03c3809f8b',
type: 'UUID',
name: 'companyId',
label: 'Company ID (foreign key)',
description: 'Foreign key for company',
icon: null,
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-bb05-45cb-aa2a-71b58d49dd23',
type: 'TEXT',
name: 'avatarUrl',
label: 'Avatar',
description: 'Contacts avatar',
icon: 'IconFileUpload',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-a3a7-4f63-9303-10226f6055be',
type: 'LINK',
name: 'xLink',
label: 'X',
description: 'Contacts X/Twitter account',
icon: 'IconBrandX',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-3b86-413e-ab56-0ebd1a583ff3',
type: 'TEXT',
name: 'jobTitle',
label: 'Job Title',
description: 'Contacts job title',
icon: 'IconBriefcase',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-8a96-4e4b-86fd-ea126530e0c1',
type: 'EMAIL',
name: 'email',
label: 'Email',
description: 'Contacts Email',
icon: 'IconMail',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-9b56-4888-bfe3-f6f59aa999e3',
type: 'FULL_NAME',
name: 'name',
label: 'Name',
description: '',
placeholder: null,
description: 'Contacts name',
icon: 'IconUser',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-78f8-4b4c-90ff-86adf77590f5',
type: 'TEXT',
name: 'city',
label: 'City',
description: 'Contacts city',
icon: 'IconMap',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-bec0-4cf0-bf1c-8b2ed21f027a',
type: 'DATE_TIME',
name: 'createdAt',
label: 'Creation date',
description: null,
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: false,
createdAt: '',
updatedAt: '',
createdAt: '2023-11-24T03:29:18.268Z',
updatedAt: '2023-11-24T03:29:18.268Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
@ -72,7 +283,7 @@ export const mockedPeopleMetadata = {
startCursor: null,
endCursor: null,
},
totalCount: 2,
totalCount: 12,
},
},
};
@ -149,7 +360,6 @@ export const mockedCompaniesMetadata = {
relationType: RelationMetadataType.OneToMany,
toObjectMetadata: {
id: mockedPeopleMetadata.node.id,
dataSourceId: mockedPeopleMetadata.node.dataSourceId,
nameSingular: mockedPeopleMetadata.node.nameSingular,
namePlural: mockedPeopleMetadata.node.namePlural,
},
@ -306,6 +516,244 @@ export const mockedWorkspacesMetadata = {
},
};
export const mockedActivitiesMetadata = {
node: {
__typename: 'object',
id: '20202020-8ee3-4f67-84ab-1b7a6eb5a448',
nameSingular: 'activity',
namePlural: 'activities',
labelSingular: 'Activity',
labelPlural: 'Activities',
description: 'An activity',
icon: 'IconCheckbox',
isCustom: false,
isActive: true,
isSystem: true,
createdAt: '2023-11-24T03:29:18.207Z',
updatedAt: '2023-11-24T03:29:18.207Z',
fields: {
edges: [
{
node: {
__typename: 'field',
id: '20202020-4694-4ec6-9084-8d932ebb3066',
type: 'UUID',
name: 'assigneeId',
label: 'Assignee id (foreign key)',
description: 'Acitivity assignee id foreign key',
icon: null,
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-88df-4202-bf82-6a06c6963280',
type: 'DATE_TIME',
name: 'updatedAt',
label: 'Update date',
description: null,
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-aff0-4961-be8a-0e5c2598b9a6',
type: 'TEXT',
name: 'body',
label: 'Body',
description: 'Activity body',
icon: 'IconList',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-cd46-44f4-bf22-b0aa20d009da',
type: 'DATE_TIME',
name: 'reminderAt',
label: 'Reminder Date',
description: 'Activity reminder date',
icon: 'IconCalendarEvent',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-2584-4797-95a8-5cc90d48c040',
type: 'TEXT',
name: 'title',
label: 'Title',
description: 'Activity title',
icon: 'IconNotes',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-f695-419c-b928-c488323d6df3',
type: 'UUID',
name: 'id',
label: 'Id',
description: null,
icon: null,
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-3acb-46bb-b993-0dc49fa2a48d',
type: 'UUID',
name: 'authorId',
label: 'Author id (foreign key)',
description: 'Activity author id foreign key',
icon: null,
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-0924-48f0-a8c2-d2dd4e2098e2',
type: 'DATE_TIME',
name: 'completedAt',
label: 'Completion Date',
description: 'Activity completion date',
icon: 'IconCheck',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-a243-4b94-a4b4-25705af86be2',
type: 'TEXT',
name: 'type',
label: 'Type',
description: 'Activity type',
icon: 'IconCheckbox',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: false,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-65a2-4d9c-b640-bac54007a14d',
type: 'DATE_TIME',
name: 'createdAt',
label: 'Creation date',
description: null,
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
node: {
__typename: 'field',
id: '20202020-20e1-4366-b386-750bdca2dfe3',
type: 'DATE_TIME',
name: 'dueAt',
label: 'Due Date',
description: 'Activity due date',
icon: 'IconCalendarEvent',
isCustom: false,
isActive: true,
isSystem: false,
isNullable: true,
createdAt: '2023-11-24T03:29:18.228Z',
updatedAt: '2023-11-24T03:29:18.228Z',
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
],
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
startCursor: null,
endCursor: null,
},
totalCount: 11,
},
},
};
export const mockedObjectMetadataItems = {
edges: [
{
@ -509,6 +957,8 @@ export const mockedObjectMetadataItems = {
mockedPeopleMetadata,
mockedCompaniesMetadata,
mockedWorkspacesMetadata,
mockedPeopleMetadata,
mockedActivitiesMetadata,
],
pageInfo: {
hasNextPage: false,
@ -516,5 +966,5 @@ export const mockedObjectMetadataItems = {
startCursor: null,
endCursor: null,
},
totalCount: 5,
totalCount: 6,
};