Fix and enhance storybook:pages tests (#3085)
* Fix and enhance storybook:pages tests Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix and enhance storybook:pages tests Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * fix SettingsObjectFieldPreview Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix lint Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix jest Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Add more fixes Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix App.stories.tsx Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> * Fix tests * Fix according to review --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -18,9 +18,11 @@ type MockedActivity = Pick<
|
||||
| 'authorId'
|
||||
| 'dueAt'
|
||||
| 'completedAt'
|
||||
| 'reminderAt'
|
||||
| 'assigneeId'
|
||||
> & {
|
||||
author: Pick<WorkspaceMember, 'id' | 'name' | 'avatarUrl'>;
|
||||
assignee: Pick<WorkspaceMember, 'id' | 'name' | 'avatarUrl'>;
|
||||
author: WorkspaceMember;
|
||||
assignee: WorkspaceMember;
|
||||
comments: Comment[];
|
||||
activityTargets: Array<
|
||||
Pick<
|
||||
@ -40,33 +42,35 @@ type MockedActivity = Pick<
|
||||
>;
|
||||
};
|
||||
|
||||
const workspaceMember: WorkspaceMember = {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
locale: 'en',
|
||||
createdAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
userId: 'e2409670-1088-46b4-858e-f20a598d9d0f',
|
||||
colorScheme: 'Light',
|
||||
};
|
||||
|
||||
export const mockedTasks: Array<MockedActivity> = [
|
||||
{
|
||||
id: '89bb825c-171e-4bcc-9cf7-43448d6fb230',
|
||||
id: 'c554852c-b28a-4307-a41d-a7a0fdde3386',
|
||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
reminderAt: null,
|
||||
title: 'My very first task',
|
||||
type: 'Task',
|
||||
body: '',
|
||||
dueAt: '2023-04-26T10:12:42.33625+00:00',
|
||||
completedAt: null,
|
||||
author: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
},
|
||||
assignee: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
},
|
||||
authorId: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
author: workspaceMember,
|
||||
assignee: workspaceMember,
|
||||
assigneeId: workspaceMember.id,
|
||||
authorId: workspaceMember.id,
|
||||
comments: [],
|
||||
activityTargets: [],
|
||||
__typename: 'Activity',
|
||||
@ -75,31 +79,19 @@ export const mockedTasks: Array<MockedActivity> = [
|
||||
|
||||
export const mockedActivities: Array<MockedActivity> = [
|
||||
{
|
||||
id: '89bb825c-171e-4bcc-9cf7-43448d6fb230',
|
||||
id: '3ecaa1be-aac7-463a-a38e-64078dd451d5',
|
||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
reminderAt: null,
|
||||
title: 'My very first note',
|
||||
type: 'Note',
|
||||
body: '',
|
||||
dueAt: '2023-04-26T10:12:42.33625+00:00',
|
||||
completedAt: null,
|
||||
author: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
},
|
||||
assignee: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
},
|
||||
authorId: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
author: workspaceMember,
|
||||
assignee: workspaceMember,
|
||||
assigneeId: workspaceMember.id,
|
||||
authorId: workspaceMember.id,
|
||||
comments: [],
|
||||
activityTargets: [
|
||||
{
|
||||
@ -149,28 +141,19 @@ export const mockedActivities: Array<MockedActivity> = [
|
||||
id: '89bb825c-171e-4bcc-9cf7-43448d6fb278a',
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
reminderAt: null,
|
||||
title: 'Another note',
|
||||
body: '',
|
||||
type: 'Note',
|
||||
completedAt: null,
|
||||
dueAt: '2029-08-26T10:12:42.33625+00:00',
|
||||
author: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
...workspaceMember,
|
||||
colorScheme: 'Dark',
|
||||
},
|
||||
assignee: {
|
||||
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
name: {
|
||||
firstName: 'Charles',
|
||||
lastName: 'Test',
|
||||
},
|
||||
avatarUrl: '',
|
||||
},
|
||||
authorId: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
|
||||
assignee: { ...workspaceMember, colorScheme: 'Dark' },
|
||||
assigneeId: workspaceMember.id,
|
||||
authorId: workspaceMember.id,
|
||||
comments: [],
|
||||
activityTargets: [
|
||||
{
|
||||
|
||||
@ -4,21 +4,8 @@ import { WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';
|
||||
|
||||
import { mockedUsersData } from './users';
|
||||
|
||||
type MockedCompany = Pick<
|
||||
Company,
|
||||
| 'id'
|
||||
| 'name'
|
||||
| 'domainName'
|
||||
| 'createdAt'
|
||||
| 'address'
|
||||
| 'employees'
|
||||
| 'linkedinUrl'
|
||||
| 'xUrl'
|
||||
| 'annualRecurringRevenue'
|
||||
| 'idealCustomerProfile'
|
||||
| 'accountOwnerId'
|
||||
> & {
|
||||
accountOwner: Pick<WorkspaceMember, 'id' | 'avatarUrl' | 'name'> | null;
|
||||
type MockedCompany = Omit<Company, 'deletedAt'> & {
|
||||
accountOwner: WorkspaceMember | null;
|
||||
Favorite: Pick<Favorite, 'id'> | null;
|
||||
};
|
||||
|
||||
@ -28,13 +15,14 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'airbnb.com',
|
||||
name: 'Airbnb',
|
||||
createdAt: '2023-04-26T10:08:54.724515+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '17 rue de clignancourt',
|
||||
employees: 12,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/airbnb/',
|
||||
label: 'https://www.linkedin.com/company/airbnb/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/airbnb',
|
||||
label: 'https://twitter.com/airbnb',
|
||||
},
|
||||
@ -49,6 +37,11 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
},
|
||||
avatarUrl: null,
|
||||
id: mockedUsersData[0].id,
|
||||
locale: 'en',
|
||||
colorScheme: 'Light',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
createdAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
userId: mockedUsersData[0].id,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -56,14 +49,15 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'aircall.io',
|
||||
name: 'Aircall',
|
||||
createdAt: '2023-04-26T10:12:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '',
|
||||
employees: 1,
|
||||
accountOwnerId: null,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/aircall/',
|
||||
label: 'https://www.linkedin.com/company/aircall/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/aircall',
|
||||
label: 'https://twitter.com/aircall',
|
||||
},
|
||||
@ -77,13 +71,14 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'algolia.com',
|
||||
name: 'Algolia',
|
||||
createdAt: '2023-04-26T10:10:32.530184+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '',
|
||||
employees: 1,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/algolia/',
|
||||
label: 'https://www.linkedin.com/company/algolia/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/algolia',
|
||||
label: 'https://twitter.com/algolia',
|
||||
},
|
||||
@ -98,13 +93,14 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'apple.com',
|
||||
name: 'Apple',
|
||||
createdAt: '2023-03-21T06:30:25.39474+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '',
|
||||
employees: 10,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/apple/',
|
||||
label: 'https://www.linkedin.com/company/apple/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/apple',
|
||||
label: 'https://twitter.com/apple',
|
||||
},
|
||||
@ -119,13 +115,14 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'qonto.com',
|
||||
name: 'Qonto',
|
||||
createdAt: '2023-04-26T10:13:29.712485+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '10 rue de la Paix',
|
||||
employees: 1,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/qonto/',
|
||||
label: 'https://www.linkedin.com/company/qonto/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/qonto',
|
||||
label: 'https://twitter.com/qonto',
|
||||
},
|
||||
@ -140,13 +137,14 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'facebook.com',
|
||||
name: 'Facebook',
|
||||
createdAt: '2023-04-26T10:09:25.656555+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '',
|
||||
employees: 1,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/facebook/',
|
||||
label: 'https://www.linkedin.com/company/facebook/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/facebook',
|
||||
label: 'https://twitter.com/facebook',
|
||||
},
|
||||
@ -161,13 +159,14 @@ export const mockedCompaniesData: Array<MockedCompany> = [
|
||||
domainName: 'sequoia.com',
|
||||
name: 'Sequoia',
|
||||
createdAt: '2023-04-26T10:09:25.656555+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
address: '',
|
||||
employees: 1,
|
||||
linkedinUrl: {
|
||||
linkedinLink: {
|
||||
url: 'https://www.linkedin.com/company/sequoia/',
|
||||
label: 'https://www.linkedin.com/company/sequoia/',
|
||||
},
|
||||
xUrl: {
|
||||
xLink: {
|
||||
url: 'https://twitter.com/sequoia',
|
||||
label: 'https://twitter.com/sequoia',
|
||||
},
|
||||
@ -187,10 +186,11 @@ export const mockedEmptyCompanyData = {
|
||||
accountOwner: null,
|
||||
annualRecurringRevenue: null,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
employees: null,
|
||||
idealCustomerProfile: null,
|
||||
linkedinUrl: null,
|
||||
xUrl: null,
|
||||
linkedinLink: null,
|
||||
xLink: null,
|
||||
_activityCount: null,
|
||||
__typename: 'Company',
|
||||
};
|
||||
|
||||
28
packages/twenty-front/src/testing/mock-data/config.ts
Normal file
28
packages/twenty-front/src/testing/mock-data/config.ts
Normal file
@ -0,0 +1,28 @@
|
||||
export const mockedClientConfig = {
|
||||
signInPrefilled: true,
|
||||
dataModelSettingsEnabled: true,
|
||||
developersSettingsEnabled: true,
|
||||
debugMode: false,
|
||||
authProviders: {
|
||||
google: true,
|
||||
password: true,
|
||||
magicLink: false,
|
||||
__typename: 'AuthProviders',
|
||||
},
|
||||
telemetry: {
|
||||
enabled: false,
|
||||
anonymizationEnabled: true,
|
||||
__typename: 'Telemetry',
|
||||
},
|
||||
support: {
|
||||
supportDriver: 'front',
|
||||
supportFrontChatId: null,
|
||||
__typename: 'Support',
|
||||
},
|
||||
billing: {
|
||||
isBillingEnabled: true,
|
||||
billingUrl: '',
|
||||
__typename: 'Billing',
|
||||
},
|
||||
__typename: 'ClientConfig',
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
|
||||
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
||||
|
||||
const dates = {
|
||||
updatedAt: '2021-06-01T10:23:42.33625+00:00',
|
||||
createdAt: '2021-06-01T10:23:42.33625+00:00',
|
||||
};
|
||||
|
||||
export const mockedPipelineSteps: Array<PipelineStep> = [
|
||||
{
|
||||
id: '6edf4ead-006a-46e1-9c6d-228f1d0143c9',
|
||||
color: 'red',
|
||||
name: 'New',
|
||||
position: 0,
|
||||
...dates,
|
||||
},
|
||||
{
|
||||
id: '30b14887-d592-427d-bd97-6e670158db02',
|
||||
color: 'sky',
|
||||
name: 'Meeting',
|
||||
position: 2,
|
||||
...dates,
|
||||
},
|
||||
{
|
||||
id: 'bea8bb7b-5467-48a6-9a8a-a8fa500123fe',
|
||||
|
||||
color: 'yellow',
|
||||
name: 'Customer',
|
||||
position: 4,
|
||||
...dates,
|
||||
},
|
||||
{
|
||||
id: 'd8361722-03fb-4e65-bd4f-ec9e52e5ec0a',
|
||||
color: 'purple',
|
||||
name: 'Screening',
|
||||
position: 1,
|
||||
...dates,
|
||||
},
|
||||
{
|
||||
id: 'db5a6648-d80d-4020-af64-4817ab4a12e8',
|
||||
color: 'turquoise',
|
||||
name: 'Proposal',
|
||||
position: 3,
|
||||
...dates,
|
||||
},
|
||||
];
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user