diff --git a/packages/twenty-front/jest.config.ts b/packages/twenty-front/jest.config.ts index 4c44ba2a6..70b145e3d 100644 --- a/packages/twenty-front/jest.config.ts +++ b/packages/twenty-front/jest.config.ts @@ -14,9 +14,9 @@ export default { extensionsToTreatAsEsm: ['.ts', '.tsx'], coverageThreshold: { global: { - statements: 10, - lines: 10, - functions: 7, + statements: 70, + lines: 70, + functions: 60, }, }, collectCoverage: true, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapFieldMetadataToGraphQLQuery.test.tsx b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapFieldMetadataToGraphQLQuery.test.tsx index a0d7f63e7..0425726a6 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapFieldMetadataToGraphQLQuery.test.tsx +++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapFieldMetadataToGraphQLQuery.test.tsx @@ -21,6 +21,7 @@ const getOneToManyRelation = () => { field: objectMetadataItem.fields.find((field) => field.name === 'company')!, res: `company { + __typename id xLink { @@ -29,6 +30,7 @@ const getOneToManyRelation = () => { } accountOwner { + __typename id } linkedinLink @@ -40,6 +42,7 @@ attachments { edges { node { + __typename id } } @@ -49,6 +52,7 @@ opportunities { edges { node { + __typename id } } @@ -65,6 +69,7 @@ activityTargets { edges { node { + __typename id } } @@ -73,6 +78,7 @@ favorites { edges { node { + __typename id } } @@ -81,6 +87,7 @@ people { edges { node { + __typename id } } @@ -129,12 +136,14 @@ const getOneToManyFromRelationField = () => { { edges { node { + __typename id personId pointOfContactId updatedAt company { + __typename id } companyId @@ -142,6 +151,7 @@ pipelineStepId probability pipelineStep { + __typename id } closeDate @@ -154,10 +164,12 @@ id createdAt pointOfContact { + __typename id } person { + __typename id } } @@ -201,9 +213,9 @@ describe('useMapFieldMetadataToGraphQLQuery', () => { const { mapFieldMetadataToGraphQLQuery } = result.current; - const oneToManyRelationFieldRes = mapFieldMetadataToGraphQLQuery( - oneToManyRelation.field, - ); + const oneToManyRelationFieldRes = mapFieldMetadataToGraphQLQuery({ + field: oneToManyRelation.field, + }); expect(formatGQLString(oneToManyRelationFieldRes)).toEqual( oneToManyRelation.res, @@ -211,26 +223,27 @@ describe('useMapFieldMetadataToGraphQLQuery', () => { const oneToOneRelation = getOneToOneRelationField(); - const oneToOneRelationFieldRes = - mapFieldMetadataToGraphQLQuery(oneToOneRelation); + const oneToOneRelationFieldRes = mapFieldMetadataToGraphQLQuery({ + field: oneToOneRelation, + }); expect(formatGQLString(oneToOneRelationFieldRes)).toEqual( oneToManyRelation.res, ); const oneToManyFromRelation = getOneToManyFromRelationField(); - const oneToManyFromRelationFieldRes = mapFieldMetadataToGraphQLQuery( - oneToManyFromRelation.field, - ); + const oneToManyFromRelationFieldRes = mapFieldMetadataToGraphQLQuery({ + field: oneToManyFromRelation.field, + }); expect(formatGQLString(oneToManyFromRelationFieldRes)).toEqual( oneToManyFromRelation.res, ); const fullNameRelation = getFullNameRelation(); - const fullNameFieldRes = mapFieldMetadataToGraphQLQuery( - fullNameRelation.field, - ); + const fullNameFieldRes = mapFieldMetadataToGraphQLQuery({ + field: fullNameRelation.field, + }); expect(fullNameFieldRes).toEqual(fullNameRelation.res); }); diff --git a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateManyRecords.ts index 72c5c6711..7fd08fc2e 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateManyRecords.ts @@ -9,6 +9,7 @@ export const query = gql` opportunities { edges { node { + __typename id } } @@ -21,12 +22,14 @@ export const query = gql` pointOfContactForOpportunities { edges { node { + __typename id } } } createdAt company { + __typename id } city @@ -34,6 +37,7 @@ export const query = gql` activityTargets { edges { node { + __typename id } } @@ -42,6 +46,7 @@ export const query = gql` favorites { edges { node { + __typename id } } @@ -49,6 +54,7 @@ export const query = gql` attachments { edges { node { + __typename id } } diff --git a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateOneRecord.ts b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateOneRecord.ts index 1599d7bc7..b7a2ebc0e 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateOneRecord.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useCreateOneRecord.ts @@ -7,6 +7,7 @@ export const query = gql` opportunities { edges { node { + __typename id } } @@ -19,12 +20,14 @@ export const query = gql` pointOfContactForOpportunities { edges { node { + __typename id } } } createdAt company { + __typename id } city @@ -32,6 +35,7 @@ export const query = gql` activityTargets { edges { node { + __typename id } } @@ -40,6 +44,7 @@ export const query = gql` favorites { edges { node { + __typename id } } @@ -47,6 +52,7 @@ export const query = gql` attachments { edges { node { + __typename id } } diff --git a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useExecuteQuickActionOnOneRecord.ts b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useExecuteQuickActionOnOneRecord.ts index 3614410ec..343e3e59e 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useExecuteQuickActionOnOneRecord.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useExecuteQuickActionOnOneRecord.ts @@ -9,6 +9,7 @@ export const query = gql` opportunities { edges { node { + __typename id } } @@ -21,12 +22,14 @@ export const query = gql` pointOfContactForOpportunities { edges { node { + __typename id } } } createdAt company { + __typename id } city @@ -34,6 +37,7 @@ export const query = gql` activityTargets { edges { node { + __typename id } } @@ -42,6 +46,7 @@ export const query = gql` favorites { edges { node { + __typename id } } @@ -49,6 +54,7 @@ export const query = gql` attachments { edges { node { + __typename id } } diff --git a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindManyRecords.ts index 62e1654bf..84eb553d9 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindManyRecords.ts @@ -15,10 +15,12 @@ export const query = gql` ) { edges { node { + __typename id opportunities { edges { node { + __typename id personId pointOfContactId @@ -44,6 +46,7 @@ export const query = gql` pointOfContactForOpportunities { edges { node { + __typename id personId pointOfContactId @@ -63,6 +66,7 @@ export const query = gql` } createdAt company { + __typename id xLink { label @@ -91,6 +95,7 @@ export const query = gql` activityTargets { edges { node { + __typename id updatedAt createdAt @@ -105,7 +110,7 @@ export const query = gql` favorites { edges { node { - id + __typename id companyId createdAt @@ -119,6 +124,7 @@ export const query = gql` attachments { edges { node { + __typename id updatedAt createdAt diff --git a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindOneRecord.ts b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindOneRecord.ts index c032d157d..d5695be62 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindOneRecord.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useFindOneRecord.ts @@ -9,6 +9,7 @@ export const query = gql` opportunities { edges { node { + __typename id } } @@ -21,12 +22,14 @@ export const query = gql` pointOfContactForOpportunities { edges { node { + __typename id } } } createdAt company { + __typename id } city @@ -34,6 +37,7 @@ export const query = gql` activityTargets { edges { node { + __typename id } } @@ -42,6 +46,7 @@ export const query = gql` favorites { edges { node { + __typename id } } @@ -49,6 +54,7 @@ export const query = gql` attachments { edges { node { + __typename id } } diff --git a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useUpdateOneRecord.ts b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useUpdateOneRecord.ts index ef39907e7..e78e9e27b 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useUpdateOneRecord.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/__mocks__/useUpdateOneRecord.ts @@ -7,6 +7,7 @@ export const query = gql` opportunities { edges { node { + __typename id } } @@ -19,12 +20,14 @@ export const query = gql` pointOfContactForOpportunities { edges { node { + __typename id } } } createdAt company { + __typename id } city @@ -32,6 +35,7 @@ export const query = gql` activityTargets { edges { node { + __typename id } } @@ -40,6 +44,7 @@ export const query = gql` favorites { edges { node { + __typename id } } @@ -47,6 +52,7 @@ export const query = gql` attachments { edges { node { + __typename id } } diff --git a/packages/twenty-front/src/modules/pipeline/hooks/__mocks__/usePipelineSteps.ts b/packages/twenty-front/src/modules/pipeline/hooks/__mocks__/usePipelineSteps.ts index 13e741596..2d7c5a434 100644 --- a/packages/twenty-front/src/modules/pipeline/hooks/__mocks__/usePipelineSteps.ts +++ b/packages/twenty-front/src/modules/pipeline/hooks/__mocks__/usePipelineSteps.ts @@ -10,6 +10,7 @@ export const query = gql` opportunities { edges { node { + __typename id } } diff --git a/packages/twenty-front/src/modules/pipeline/hooks/__tests__/usePipelineSteps.test.tsx b/packages/twenty-front/src/modules/pipeline/hooks/__tests__/usePipelineSteps.test.tsx index 1b8509ed6..b8c7c044e 100644 --- a/packages/twenty-front/src/modules/pipeline/hooks/__tests__/usePipelineSteps.test.tsx +++ b/packages/twenty-front/src/modules/pipeline/hooks/__tests__/usePipelineSteps.test.tsx @@ -70,7 +70,7 @@ describe('usePipelineSteps', () => { ); const boardColumn: BoardColumnDefinition = { - id: 'columnId', + id: mockId, title: 'Column Title', colorCode: 'yellow', position: 1, diff --git a/packages/twenty-front/src/utils/__tests__/debounce.test.ts b/packages/twenty-front/src/utils/__tests__/debounce.test.ts deleted file mode 100644 index 43a56a56f..000000000 --- a/packages/twenty-front/src/utils/__tests__/debounce.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { debounce } from '../debounce'; - -describe('debounce', () => { - it('should debounce a function', () => { - jest.useFakeTimers(); - - const func = jest.fn(); - const debouncedFunc = debounce(func, 1000); - - debouncedFunc(); - debouncedFunc(); - debouncedFunc(); - - expect(func).not.toHaveBeenCalled(); - - jest.runAllTimers(); - - expect(func).toHaveBeenCalledTimes(1); - }); -});