Fix calendar broken tests

This commit is contained in:
Charles Bochet 2024-03-15 19:39:01 +01:00
parent 8980cc576c
commit cd9f402bc2
3 changed files with 498 additions and 1 deletions

View File

@ -2,13 +2,16 @@ import { Meta, StoryObj } from '@storybook/react';
import { Calendar } from '@/activities/calendar/components/Calendar';
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
const meta: Meta<typeof Calendar> = {
title: 'Modules/Activities/Calendar/Calendar',
component: Calendar,
decorators: [ComponentDecorator],
decorators: [ComponentDecorator, SnackBarDecorator],
parameters: {
container: { width: 728 },
msw: graphqlMocks,
},
};

View File

@ -19,6 +19,23 @@ export const getObjectMetadataItemsMock = () => {
updatedAt: '2023-11-30T11:13:15.206Z',
fields: [],
},
{
__typename: 'object',
id: '20202020-ddee-40de-9c9b-5f82a3503361',
dataSourceId: '20202020-7f63-47a9-b1b3-6c7290ca9fb1',
nameSingular: 'calendarEvent',
namePlural: 'calendarEvents',
labelSingular: 'Calendar Event',
labelPlural: 'Calendar Events',
description: 'A calendar event',
icon: 'IconCalendarEvent',
isCustom: false,
isActive: true,
isSystem: true,
createdAt: '2023-11-30T11:13:15.206Z',
updatedAt: '2023-11-30T11:13:15.206Z',
fields: [],
},
{
__typename: 'object',
id: '20202020-d8d0-4c2d-a370-5499b2181d02',

View File

@ -1398,6 +1398,482 @@ export const mockedPipelineStepsMetadata = {
},
};
const mockedCalendarEventsMetadata = {
__typename: 'objectEdge',
node: {
__typename: 'object',
id: 'dd77da2e-bc12-4443-b323-097656d720fc',
dataSourceId: 'fa94b810-e848-490c-a5f7-24a1ee5bfaa6',
nameSingular: 'calendarEvent',
namePlural: 'calendarEvents',
labelSingular: 'Calendar event',
labelPlural: 'Calendar events',
description: 'Calendar events',
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
labelIdentifierFieldMetadataId: null,
imageIdentifierFieldMetadataId: null,
fields: {
__typename: 'ObjectFieldsConnection',
pageInfo: {
__typename: 'PageInfo',
hasNextPage: false,
hasPreviousPage: false,
startCursor: 'YXJyYXljb25uZWN0aW9uOjA=',
endCursor: 'YXJyYXljb25uZWN0aW9uOjE3',
},
edges: [
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '6fee09b1-a964-4b34-b239-a38d91b137f1',
type: 'DATE_TIME',
name: 'endsAt',
label: 'End DateTime',
description: 'End DateTime',
icon: 'IconCalendarClock',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '071d3b2a-9168-45bb-9a83-e840eb707d14',
type: 'TEXT',
name: 'conferenceUri',
label: 'Conference URI',
description: 'Conference URI',
icon: 'IconLink',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: 'dce09597-dde3-462b-8a8b-d0bae238df2b',
type: 'RELATION',
name: 'calendarChannelEventAssociations',
label: 'Calendar Channel Event Associations',
description: 'Calendar Channel Event Associations',
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
toRelationMetadata: null,
fromRelationMetadata: {
__typename: 'relation',
id: 'f4950160-aabd-44a3-b369-37b03b8f9ac6',
relationType: 'ONE_TO_MANY',
toFieldMetadataId: '8b4cd1d9-cd30-40c5-a01c-0d468443a704',
toObjectMetadata: {
__typename: 'object',
id: '7dd1f608-7696-43d1-8b5e-c95ea78b1e7a',
dataSourceId: 'fa94b810-e848-490c-a5f7-24a1ee5bfaa6',
nameSingular: 'calendarChannelEventAssociation',
namePlural: 'calendarChannelEventAssociations',
isSystem: true,
},
},
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: 'ad4c78c7-1353-4f31-b2bf-57d97c528d4a',
type: 'TEXT',
name: 'iCalUID',
label: 'iCal UID',
description: 'iCal UID',
icon: 'IconKey',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '65a99333-4cd9-44af-94cc-e19a479ecc1e',
type: 'TEXT',
name: 'title',
label: 'Title',
description: 'Title',
icon: 'IconH1',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: 'd9cd21f2-7401-4873-b19c-3c9d7ed8bee2',
type: 'TEXT',
name: 'recurringEventExternalId',
label: 'Recurring Event ID',
description: 'Recurring Event ID',
icon: 'IconHistory',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '38f3297b-fe2e-434f-867b-963ed2c75ee0',
type: 'DATE_TIME',
name: 'externalCreatedAt',
label: 'Creation DateTime',
description: 'Creation DateTime',
icon: 'IconCalendarPlus',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '5232193e-6016-4f13-bdcd-95478dfe8e4a',
type: 'TEXT',
name: 'location',
label: 'Location',
description: 'Location',
icon: 'IconMapPin',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: 'bb49e0cc-72e6-4bc5-8bae-75e7b4f6cd53',
type: 'DATE_TIME',
name: 'startsAt',
label: 'Start DateTime',
description: 'Start DateTime',
icon: 'IconCalendarClock',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '07880d2d-4f08-458f-be0b-876402d2a769',
type: 'RELATION',
name: 'eventAttendees',
label: 'Event Attendees',
description: 'Event Attendees',
icon: 'IconUserCircle',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
toRelationMetadata: null,
fromRelationMetadata: {
__typename: 'relation',
id: '6ca76ccc-bdb1-4357-809e-66149e54474b',
relationType: 'ONE_TO_MANY',
toFieldMetadataId: '2ad8bb23-68f5-4a77-b23f-cac8db34a5f0',
toObjectMetadata: {
__typename: 'object',
id: '4adb1b1a-9643-4d1c-a2a0-b1b02ae192ad',
dataSourceId: 'fa94b810-e848-490c-a5f7-24a1ee5bfaa6',
nameSingular: 'calendarEventAttendee',
namePlural: 'calendarEventAttendees',
isSystem: true,
},
},
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '0d348548-f8a8-4669-872e-43ef01e3d93b',
type: 'DATE_TIME',
name: 'externalUpdatedAt',
label: 'Update DateTime',
description: 'Update DateTime',
icon: 'IconCalendarCog',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: true,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '37d357eb-fc04-4b5c-a633-345b677d2c87',
type: 'TEXT',
name: 'description',
label: 'Description',
description: 'Description',
icon: 'IconFileDescription',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '3d14da78-db95-403e-bb2f-06ed076574cb',
type: 'TEXT',
name: 'conferenceSolution',
label: 'Conference Solution',
description: 'Conference Solution',
icon: 'IconScreenShare',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
value: '',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '847a63f7-0614-4491-b445-c67269868c93',
type: 'UUID',
name: 'id',
label: 'Id',
description: 'Id',
icon: 'Icon123',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
type: 'uuid',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '1d7a9a99-b6ef-4fae-abcd-60bba4d4cf5b',
type: 'BOOLEAN',
name: 'isFullDay',
label: 'Is Full Day',
description: 'Is Full Day',
icon: 'Icon24Hours',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: '91058295-2974-4924-937a-2e6dec4b3b01',
type: 'BOOLEAN',
name: 'isCanceled',
label: 'Is canceled',
description: 'Is canceled',
icon: 'IconCalendarCancel',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: null,
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: 'b93abe19-6228-4971-9ef0-4e38ef5ed314',
type: 'DATE_TIME',
name: 'createdAt',
label: 'Creation date',
description: 'Creation date',
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
type: 'now',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
{
__typename: 'fieldEdge',
node: {
__typename: 'field',
id: 'f8b1abe7-8d26-4502-ac15-6f49c5112bb0',
type: 'DATE_TIME',
name: 'updatedAt',
label: 'Update date',
description: 'Update date',
icon: 'IconCalendar',
isCustom: false,
isActive: true,
isSystem: true,
isNullable: false,
createdAt: '2024-03-15T13:39:09.965Z',
updatedAt: '2024-03-15T13:39:09.965Z',
defaultValue: {
type: 'now',
},
options: null,
fromRelationMetadata: null,
toRelationMetadata: null,
},
},
],
},
},
} as ObjectEdge;
export const mockedActivityTargetsMetadata = {
__typename: 'objectEdge',
node: {
@ -7035,6 +7511,7 @@ export const mockedObjectMetadataItems = {
mockedConnectedAccountsMetadata,
mockedMessageChannelsMetadata,
mockedWebhooksMetadata,
mockedCalendarEventsMetadata,
mockedAttachmentsMetadata,
mockedMessageParticipantsMetadata,
mockedCustomMetadata,