-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...imelineActivities/rows/calendar/components/__stories__/EventCardCalendarEvent.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { graphql, HttpResponse } from 'msw'; | ||
import { ComponentDecorator } from 'twenty-ui'; | ||
|
||
import { EventCardCalendarEvent } from '@/activities/timelineActivities/rows/calendar/components/EventCardCalendarEvent'; | ||
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator'; | ||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator'; | ||
|
||
const meta: Meta<typeof EventCardCalendarEvent> = { | ||
title: 'Modules/TimelineActivities/Rows/CalendarEvent/EventCardCalendarEvent', | ||
component: EventCardCalendarEvent, | ||
decorators: [ | ||
ComponentDecorator, | ||
ObjectMetadataItemsDecorator, | ||
SnackBarDecorator, | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof EventCardCalendarEvent>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
calendarEventId: '1', | ||
}, | ||
parameters: { | ||
msw: { | ||
handlers: [ | ||
graphql.query('FindOneCalendarEvent', () => { | ||
return HttpResponse.json({ | ||
data: { | ||
calendarEvent: { | ||
id: '1', | ||
title: 'Mock title', | ||
startsAt: '2022-01-01T00:00:00Z', | ||
endsAt: '2022-01-01T01:00:00Z', | ||
}, | ||
}, | ||
}); | ||
}), | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const NotShared: Story = { | ||
args: { | ||
calendarEventId: '1', | ||
}, | ||
parameters: { | ||
msw: { | ||
handlers: [ | ||
graphql.query('FindOneCalendarEvent', () => { | ||
return HttpResponse.json({ | ||
errors: [ | ||
{ | ||
message: 'Forbidden', | ||
extensions: { | ||
code: 'FORBIDDEN', | ||
}, | ||
}, | ||
], | ||
}); | ||
}), | ||
], | ||
}, | ||
}, | ||
}; |
51 changes: 51 additions & 0 deletions
51
...eActivities/rows/main-object/components/__stories__/EventRowMainObjectUpdated.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { ComponentDecorator, RouterDecorator } from 'twenty-ui'; | ||
|
||
import { EventRowMainObjectUpdated } from '@/activities/timelineActivities/rows/main-object/components/EventRowMainObjectUpdated'; | ||
import { TimelineActivity } from '@/activities/timelineActivities/types/TimelineActivity'; | ||
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator'; | ||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator'; | ||
import { mockedPersonObjectMetadataItem } from '~/testing/mock-data/metadata'; | ||
|
||
const meta: Meta<typeof EventRowMainObjectUpdated> = { | ||
title: 'Modules/TimelineActivities/Rows/MainObject/EventRowMainObjectUpdated', | ||
component: EventRowMainObjectUpdated, | ||
args: { | ||
authorFullName: 'John Doe', | ||
labelIdentifierValue: 'Mock', | ||
event: { | ||
id: '1', | ||
name: 'mock.updated', | ||
properties: { | ||
diff: { | ||
jobTitle: { | ||
after: 'mock job title', | ||
before: '', | ||
}, | ||
linkedinLink: { | ||
after: { | ||
url: 'mock.linkedin', | ||
label: 'mock linkedin url', | ||
}, | ||
before: { | ||
url: '', | ||
label: '', | ||
}, | ||
}, | ||
}, | ||
}, | ||
} as TimelineActivity, | ||
mainObjectMetadataItem: mockedPersonObjectMetadataItem, | ||
}, | ||
decorators: [ | ||
ComponentDecorator, | ||
ObjectMetadataItemsDecorator, | ||
SnackBarDecorator, | ||
RouterDecorator, | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof EventRowMainObjectUpdated>; | ||
|
||
export const Default: Story = {}; |