Fix all broken CIs (#7439)
Fix all the broken CIs :p This includes an ongoing effort to simplify test maintenance by having 1 unique source of truth about metadata and data mocks (that will later be generated from a unique source of seeds: dev = demo = test) Regressions: - Unit line coverage: 60 > 55 - Storybook Pages branch coverage: 40 > 35 We will need to write tests to increase those coverage - RelationFieldDisplay perf: 0.2ms to 0.22ms > We might have a regression here - Removed perf story about RawJSON > We will need to re-add it
This commit is contained in:
committed by
Charles Bochet
parent
bd305c8432
commit
d8c4af9279
@ -42,5 +42,8 @@ export const WithTasks: Story = {
|
||||
},
|
||||
parameters: {
|
||||
msw: graphqlMocks,
|
||||
container: {
|
||||
width: '500px',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -3,6 +3,7 @@ import { ComponentDecorator } from 'twenty-ui';
|
||||
|
||||
import { TaskList } from '@/activities/tasks/components/TaskList';
|
||||
import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
|
||||
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
|
||||
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { mockedTasks } from '~/testing/mock-data/tasks';
|
||||
@ -10,13 +11,21 @@ import { mockedTasks } from '~/testing/mock-data/tasks';
|
||||
const meta: Meta<typeof TaskList> = {
|
||||
title: 'Modules/Activity/TaskList',
|
||||
component: TaskList,
|
||||
decorators: [MemoryRouterDecorator, ComponentDecorator, SnackBarDecorator],
|
||||
decorators: [
|
||||
ComponentDecorator,
|
||||
MemoryRouterDecorator,
|
||||
ObjectMetadataItemsDecorator,
|
||||
SnackBarDecorator,
|
||||
],
|
||||
args: {
|
||||
title: 'Tasks',
|
||||
tasks: mockedTasks,
|
||||
},
|
||||
parameters: {
|
||||
msw: graphqlMocks,
|
||||
container: {
|
||||
width: '500px',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ import { TaskList } from './TaskList';
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
type TaskGroupsProps = {
|
||||
|
||||
@ -12,6 +12,7 @@ type TaskListProps = {
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
align-self: stretch;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import { MockedProvider, MockedResponse } from '@apollo/client/testing';
|
||||
import { MockedResponse } from '@apollo/client/testing';
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import gql from 'graphql-tag';
|
||||
import { ReactNode } from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
import { useCompleteTask } from '@/activities/tasks/hooks/useCompleteTask';
|
||||
import { Task } from '@/activities/types/Task';
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const task: Task = {
|
||||
id: '123',
|
||||
@ -28,21 +27,123 @@ const mocks: MockedResponse[] = [
|
||||
mutation UpdateOneTask($idToUpdate: ID!, $input: TaskUpdateInput!) {
|
||||
updateTask(id: $idToUpdate, data: $input) {
|
||||
__typename
|
||||
updatedAt
|
||||
createdAt
|
||||
deletedAt
|
||||
dueAt
|
||||
id
|
||||
status
|
||||
assignee {
|
||||
__typename
|
||||
avatarUrl
|
||||
colorScheme
|
||||
createdAt
|
||||
dateFormat
|
||||
deletedAt
|
||||
id
|
||||
locale
|
||||
name {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
timeFormat
|
||||
timeZone
|
||||
updatedAt
|
||||
userEmail
|
||||
userId
|
||||
}
|
||||
assigneeId
|
||||
attachments {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
activityId
|
||||
authorId
|
||||
companyId
|
||||
createdAt
|
||||
deletedAt
|
||||
fullPath
|
||||
id
|
||||
name
|
||||
noteId
|
||||
opportunityId
|
||||
personId
|
||||
rocketId
|
||||
taskId
|
||||
type
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
body
|
||||
createdAt
|
||||
createdBy {
|
||||
source
|
||||
workspaceMemberId
|
||||
name
|
||||
}
|
||||
assigneeId
|
||||
deletedAt
|
||||
dueAt
|
||||
favorites {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
companyId
|
||||
createdAt
|
||||
deletedAt
|
||||
id
|
||||
noteId
|
||||
opportunityId
|
||||
personId
|
||||
position
|
||||
rocketId
|
||||
taskId
|
||||
updatedAt
|
||||
viewId
|
||||
workflowId
|
||||
workspaceMemberId
|
||||
}
|
||||
}
|
||||
}
|
||||
id
|
||||
position
|
||||
status
|
||||
taskTargets {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
companyId
|
||||
createdAt
|
||||
deletedAt
|
||||
id
|
||||
opportunityId
|
||||
personId
|
||||
rocketId
|
||||
taskId
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
timelineActivities {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
companyId
|
||||
createdAt
|
||||
deletedAt
|
||||
happensAt
|
||||
id
|
||||
linkedObjectMetadataId
|
||||
linkedRecordCachedName
|
||||
linkedRecordId
|
||||
name
|
||||
noteId
|
||||
opportunityId
|
||||
personId
|
||||
properties
|
||||
rocketId
|
||||
taskId
|
||||
updatedAt
|
||||
workspaceMemberId
|
||||
}
|
||||
}
|
||||
}
|
||||
title
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
`,
|
||||
@ -72,13 +173,9 @@ const mocks: MockedResponse[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const Wrapper = ({ children }: { children: ReactNode }) => (
|
||||
<RecoilRoot>
|
||||
<MockedProvider mocks={mocks} addTypename={false}>
|
||||
{children}
|
||||
</MockedProvider>
|
||||
</RecoilRoot>
|
||||
);
|
||||
const Wrapper = getJestMetadataAndApolloMocksWrapper({
|
||||
apolloMocks: mocks,
|
||||
});
|
||||
|
||||
describe('useCompleteTask', () => {
|
||||
it('should complete task', async () => {
|
||||
|
||||
Reference in New Issue
Block a user