mirror of
https://github.com/twentyhq/twenty.git
synced 2024-10-04 21:07:21 +03:00
Enfoce high jest code coverage
This commit is contained in:
parent
cca72da708
commit
66adbb1783
@ -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,
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ export const query = gql`
|
||||
opportunities {
|
||||
edges {
|
||||
node {
|
||||
__typename
|
||||
id
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ describe('usePipelineSteps', () => {
|
||||
);
|
||||
|
||||
const boardColumn: BoardColumnDefinition = {
|
||||
id: 'columnId',
|
||||
id: mockId,
|
||||
title: 'Column Title',
|
||||
colorCode: 'yellow',
|
||||
position: 1,
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user