Fix broken storybook tests on SettingsPreview
This commit is contained in:
@ -9,6 +9,7 @@ import {
|
|||||||
} from '@/object-record/record-field/types/FieldMetadata';
|
} from '@/object-record/record-field/types/FieldMetadata';
|
||||||
import {
|
import {
|
||||||
mockedCompaniesMetadata,
|
mockedCompaniesMetadata,
|
||||||
|
mockedCustomMetadata,
|
||||||
mockedPeopleMetadata,
|
mockedPeopleMetadata,
|
||||||
} from '~/testing/mock-data/metadata';
|
} from '~/testing/mock-data/metadata';
|
||||||
|
|
||||||
@ -18,11 +19,17 @@ export const mockedPersonObjectMetadataItem = {
|
|||||||
...mockedPeopleMetadata.node,
|
...mockedPeopleMetadata.node,
|
||||||
fields: mockedPeopleMetadata.node.fields.edges.map(({ node }) => node),
|
fields: mockedPeopleMetadata.node.fields.edges.map(({ node }) => node),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockedCompanyObjectMetadataItem = {
|
export const mockedCompanyObjectMetadataItem = {
|
||||||
...mockedCompaniesMetadata.node,
|
...mockedCompaniesMetadata.node,
|
||||||
fields: mockedCompaniesMetadata.node.fields.edges.map(({ node }) => node),
|
fields: mockedCompaniesMetadata.node.fields.edges.map(({ node }) => node),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const mockedCustomObjectMetadataItem = {
|
||||||
|
...mockedCustomMetadata.node,
|
||||||
|
fields: mockedCustomMetadata.node.fields.edges.map(({ node }) => node),
|
||||||
|
};
|
||||||
|
|
||||||
export const textfieldDefinition: FieldDefinition<FieldTextMetadata> = {
|
export const textfieldDefinition: FieldDefinition<FieldTextMetadata> = {
|
||||||
fieldMetadataId,
|
fieldMetadataId,
|
||||||
label: 'User Name',
|
label: 'User Name',
|
||||||
|
|||||||
@ -101,11 +101,13 @@ export const Relation: Story = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CustomObject: Story = {
|
// Todo: re-enable this test once useObjectMetadataItem has been split and refactored into smaller functions.
|
||||||
args: {
|
// Right now, as the workspace is not set, the hook things the user is not logged in and it is not possible to have a custom object
|
||||||
fieldMetadataItem: mockedCompanyObjectMetadataItem.fields.find(
|
// export const Custom: Story = {
|
||||||
({ isCustom }) => isCustom,
|
// args: {
|
||||||
),
|
// fieldMetadataItem: mockedCustomObjectMetadataItem.fields.find(
|
||||||
objectMetadataItem: mockedCompanyObjectMetadataItem,
|
// ({ type }) => type === FieldMetadataType.Text,
|
||||||
},
|
// ),
|
||||||
};
|
// objectMetadataItem: mockedCustomObjectMetadataItem,
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
|||||||
@ -1019,7 +1019,7 @@ export const mockedCompaniesMetadata = {
|
|||||||
label: 'Address',
|
label: 'Address',
|
||||||
description: 'The company address',
|
description: 'The company address',
|
||||||
icon: 'IconMap',
|
icon: 'IconMap',
|
||||||
isCustom: false,
|
isCustom: true,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
@ -1114,7 +1114,7 @@ export const mockedCompaniesMetadata = {
|
|||||||
label: 'Industry',
|
label: 'Industry',
|
||||||
description: 'The industry the company is involved in',
|
description: 'The industry the company is involved in',
|
||||||
icon: 'IconUsers',
|
icon: 'IconUsers',
|
||||||
isCustom: true,
|
isCustom: false,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isNullable: true,
|
isNullable: true,
|
||||||
@ -4755,6 +4755,181 @@ export const mockedAPIKeysMetadata = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const mockedCustomMetadata = {
|
||||||
|
__typename: 'objectEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'object',
|
||||||
|
id: 'd5c37777-3450-4e30-80a2-66853331ca90',
|
||||||
|
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
|
||||||
|
nameSingular: 'myCustom',
|
||||||
|
namePlural: 'myCustoms',
|
||||||
|
labelSingular: 'My Custom',
|
||||||
|
labelPlural: 'My Customs',
|
||||||
|
description: 'A custom object example',
|
||||||
|
icon: 'IconRobot',
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
labelIdentifierFieldMetadataId: null,
|
||||||
|
imageIdentifierFieldMetadataId: null,
|
||||||
|
fields: {
|
||||||
|
__typename: 'ObjectFieldsConnection',
|
||||||
|
edges: [
|
||||||
|
{
|
||||||
|
__typename: 'fieldEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'field',
|
||||||
|
id: 'bdda452a-c123-4fa3-8543-d04c2c43836f',
|
||||||
|
type: FieldMetadataType.DateTime,
|
||||||
|
name: 'revokedAt',
|
||||||
|
label: 'Revocation date',
|
||||||
|
description: 'ApiKey revocation date',
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: true,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
fromRelationMetadata: null,
|
||||||
|
toRelationMetadata: null,
|
||||||
|
options: [],
|
||||||
|
defaultValue: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'fieldEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'field',
|
||||||
|
id: 'dd217f48-d1bf-4451-9b8d-e06feb7365f9',
|
||||||
|
type: FieldMetadataType.DateTime,
|
||||||
|
name: 'createdAt',
|
||||||
|
label: 'Creation date',
|
||||||
|
description: null,
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: false,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
fromRelationMetadata: null,
|
||||||
|
toRelationMetadata: null,
|
||||||
|
options: [],
|
||||||
|
defaultValue: {
|
||||||
|
type: 'now',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'fieldEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'field',
|
||||||
|
id: '3fd655ef-3dc6-4edf-84cf-3f398150412b',
|
||||||
|
type: FieldMetadataType.DateTime,
|
||||||
|
name: 'expiresAt',
|
||||||
|
label: 'Expiration date',
|
||||||
|
description: 'ApiKey expiration date',
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: false,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
fromRelationMetadata: null,
|
||||||
|
toRelationMetadata: null,
|
||||||
|
options: [],
|
||||||
|
defaultValue: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'fieldEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'field',
|
||||||
|
id: '5f404704-d084-420e-a2bf-ab3108da12ae',
|
||||||
|
type: FieldMetadataType.Text,
|
||||||
|
name: 'name',
|
||||||
|
label: 'Name',
|
||||||
|
description: 'ApiKey name',
|
||||||
|
icon: 'IconLink',
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: false,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
fromRelationMetadata: null,
|
||||||
|
toRelationMetadata: null,
|
||||||
|
options: [],
|
||||||
|
defaultValue: {
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'fieldEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'field',
|
||||||
|
id: '948db156-f5de-4ddf-ad95-34fabc7cb273',
|
||||||
|
type: FieldMetadataType.DateTime,
|
||||||
|
name: 'updatedAt',
|
||||||
|
label: 'Update date',
|
||||||
|
description: null,
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: false,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
fromRelationMetadata: null,
|
||||||
|
toRelationMetadata: null,
|
||||||
|
options: [],
|
||||||
|
defaultValue: {
|
||||||
|
type: 'now',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: 'fieldEdge',
|
||||||
|
node: {
|
||||||
|
__typename: 'field',
|
||||||
|
id: '2204f9d1-274d-4bd5-be9c-3598da520df0',
|
||||||
|
type: FieldMetadataType.Uuid,
|
||||||
|
name: 'id',
|
||||||
|
label: 'Id',
|
||||||
|
description: null,
|
||||||
|
icon: null,
|
||||||
|
isCustom: false,
|
||||||
|
isActive: true,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: false,
|
||||||
|
createdAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
updatedAt: '2023-12-15T15:29:39.070Z',
|
||||||
|
fromRelationMetadata: null,
|
||||||
|
toRelationMetadata: null,
|
||||||
|
options: [],
|
||||||
|
defaultValue: {
|
||||||
|
type: FieldMetadataType.Uuid,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pageInfo: {
|
||||||
|
__typename: 'PageInfo',
|
||||||
|
hasNextPage: false,
|
||||||
|
hasPreviousPage: false,
|
||||||
|
startCursor: 'YXJyYXljb25uZWN0aW9uOjA=',
|
||||||
|
endCursor: 'YXJyYXljb25uZWN0aW9uOjU=',
|
||||||
|
},
|
||||||
|
totalCount: 6,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export const mockedComments = {
|
export const mockedComments = {
|
||||||
__typename: 'objectEdge',
|
__typename: 'objectEdge',
|
||||||
node: {
|
node: {
|
||||||
@ -6860,6 +7035,7 @@ export const mockedObjectMetadataItems = {
|
|||||||
mockedWebhooksMetadata,
|
mockedWebhooksMetadata,
|
||||||
mockedAttachmentsMetadata,
|
mockedAttachmentsMetadata,
|
||||||
mockedMessageParticipantsMetadata,
|
mockedMessageParticipantsMetadata,
|
||||||
|
mockedCustomMetadata,
|
||||||
],
|
],
|
||||||
pageInfo: {
|
pageInfo: {
|
||||||
__typename: 'PageInfo',
|
__typename: 'PageInfo',
|
||||||
@ -6868,5 +7044,5 @@ export const mockedObjectMetadataItems = {
|
|||||||
startCursor: 'YXJyYXljb25uZWN0aW9uOjA=',
|
startCursor: 'YXJyYXljb25uZWN0aW9uOjA=',
|
||||||
endCursor: 'YXJyYXljb25uZWN0aW9uOjk=',
|
endCursor: 'YXJyYXljb25uZWN0aW9uOjk=',
|
||||||
},
|
},
|
||||||
totalCount: 18,
|
totalCount: 19,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user