Enfoce high jest code coverage
This commit is contained in:
@ -14,9 +14,9 @@ export default {
|
|||||||
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
statements: 10,
|
statements: 70,
|
||||||
lines: 10,
|
lines: 70,
|
||||||
functions: 7,
|
functions: 60,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
|
|||||||
@ -21,6 +21,7 @@ const getOneToManyRelation = () => {
|
|||||||
field: objectMetadataItem.fields.find((field) => field.name === 'company')!,
|
field: objectMetadataItem.fields.find((field) => field.name === 'company')!,
|
||||||
res: `company
|
res: `company
|
||||||
{
|
{
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
xLink
|
xLink
|
||||||
{
|
{
|
||||||
@ -29,6 +30,7 @@ const getOneToManyRelation = () => {
|
|||||||
}
|
}
|
||||||
accountOwner
|
accountOwner
|
||||||
{
|
{
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
linkedinLink
|
linkedinLink
|
||||||
@ -40,6 +42,7 @@ attachments
|
|||||||
{
|
{
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,6 +52,7 @@ opportunities
|
|||||||
{
|
{
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,6 +69,7 @@ activityTargets
|
|||||||
{
|
{
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,6 +78,7 @@ favorites
|
|||||||
{
|
{
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,6 +87,7 @@ people
|
|||||||
{
|
{
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,12 +136,14 @@ const getOneToManyFromRelationField = () => {
|
|||||||
{
|
{
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
personId
|
personId
|
||||||
pointOfContactId
|
pointOfContactId
|
||||||
updatedAt
|
updatedAt
|
||||||
company
|
company
|
||||||
{
|
{
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
companyId
|
companyId
|
||||||
@ -142,6 +151,7 @@ pipelineStepId
|
|||||||
probability
|
probability
|
||||||
pipelineStep
|
pipelineStep
|
||||||
{
|
{
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
closeDate
|
closeDate
|
||||||
@ -154,10 +164,12 @@ id
|
|||||||
createdAt
|
createdAt
|
||||||
pointOfContact
|
pointOfContact
|
||||||
{
|
{
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
person
|
person
|
||||||
{
|
{
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,9 +213,9 @@ describe('useMapFieldMetadataToGraphQLQuery', () => {
|
|||||||
|
|
||||||
const { mapFieldMetadataToGraphQLQuery } = result.current;
|
const { mapFieldMetadataToGraphQLQuery } = result.current;
|
||||||
|
|
||||||
const oneToManyRelationFieldRes = mapFieldMetadataToGraphQLQuery(
|
const oneToManyRelationFieldRes = mapFieldMetadataToGraphQLQuery({
|
||||||
oneToManyRelation.field,
|
field: oneToManyRelation.field,
|
||||||
);
|
});
|
||||||
|
|
||||||
expect(formatGQLString(oneToManyRelationFieldRes)).toEqual(
|
expect(formatGQLString(oneToManyRelationFieldRes)).toEqual(
|
||||||
oneToManyRelation.res,
|
oneToManyRelation.res,
|
||||||
@ -211,26 +223,27 @@ describe('useMapFieldMetadataToGraphQLQuery', () => {
|
|||||||
|
|
||||||
const oneToOneRelation = getOneToOneRelationField();
|
const oneToOneRelation = getOneToOneRelationField();
|
||||||
|
|
||||||
const oneToOneRelationFieldRes =
|
const oneToOneRelationFieldRes = mapFieldMetadataToGraphQLQuery({
|
||||||
mapFieldMetadataToGraphQLQuery(oneToOneRelation);
|
field: oneToOneRelation,
|
||||||
|
});
|
||||||
|
|
||||||
expect(formatGQLString(oneToOneRelationFieldRes)).toEqual(
|
expect(formatGQLString(oneToOneRelationFieldRes)).toEqual(
|
||||||
oneToManyRelation.res,
|
oneToManyRelation.res,
|
||||||
);
|
);
|
||||||
|
|
||||||
const oneToManyFromRelation = getOneToManyFromRelationField();
|
const oneToManyFromRelation = getOneToManyFromRelationField();
|
||||||
const oneToManyFromRelationFieldRes = mapFieldMetadataToGraphQLQuery(
|
const oneToManyFromRelationFieldRes = mapFieldMetadataToGraphQLQuery({
|
||||||
oneToManyFromRelation.field,
|
field: oneToManyFromRelation.field,
|
||||||
);
|
});
|
||||||
|
|
||||||
expect(formatGQLString(oneToManyFromRelationFieldRes)).toEqual(
|
expect(formatGQLString(oneToManyFromRelationFieldRes)).toEqual(
|
||||||
oneToManyFromRelation.res,
|
oneToManyFromRelation.res,
|
||||||
);
|
);
|
||||||
|
|
||||||
const fullNameRelation = getFullNameRelation();
|
const fullNameRelation = getFullNameRelation();
|
||||||
const fullNameFieldRes = mapFieldMetadataToGraphQLQuery(
|
const fullNameFieldRes = mapFieldMetadataToGraphQLQuery({
|
||||||
fullNameRelation.field,
|
field: fullNameRelation.field,
|
||||||
);
|
});
|
||||||
|
|
||||||
expect(fullNameFieldRes).toEqual(fullNameRelation.res);
|
expect(fullNameFieldRes).toEqual(fullNameRelation.res);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9,6 +9,7 @@ export const query = gql`
|
|||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,12 +22,14 @@ export const query = gql`
|
|||||||
pointOfContactForOpportunities {
|
pointOfContactForOpportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
company {
|
company {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
city
|
city
|
||||||
@ -34,6 +37,7 @@ export const query = gql`
|
|||||||
activityTargets {
|
activityTargets {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,6 +46,7 @@ export const query = gql`
|
|||||||
favorites {
|
favorites {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,6 +54,7 @@ export const query = gql`
|
|||||||
attachments {
|
attachments {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export const query = gql`
|
|||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,12 +20,14 @@ export const query = gql`
|
|||||||
pointOfContactForOpportunities {
|
pointOfContactForOpportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
company {
|
company {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
city
|
city
|
||||||
@ -32,6 +35,7 @@ export const query = gql`
|
|||||||
activityTargets {
|
activityTargets {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,6 +44,7 @@ export const query = gql`
|
|||||||
favorites {
|
favorites {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,6 +52,7 @@ export const query = gql`
|
|||||||
attachments {
|
attachments {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ export const query = gql`
|
|||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,12 +22,14 @@ export const query = gql`
|
|||||||
pointOfContactForOpportunities {
|
pointOfContactForOpportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
company {
|
company {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
city
|
city
|
||||||
@ -34,6 +37,7 @@ export const query = gql`
|
|||||||
activityTargets {
|
activityTargets {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,6 +46,7 @@ export const query = gql`
|
|||||||
favorites {
|
favorites {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,6 +54,7 @@ export const query = gql`
|
|||||||
attachments {
|
attachments {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,10 +15,12 @@ export const query = gql`
|
|||||||
) {
|
) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
personId
|
personId
|
||||||
pointOfContactId
|
pointOfContactId
|
||||||
@ -44,6 +46,7 @@ export const query = gql`
|
|||||||
pointOfContactForOpportunities {
|
pointOfContactForOpportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
personId
|
personId
|
||||||
pointOfContactId
|
pointOfContactId
|
||||||
@ -63,6 +66,7 @@ export const query = gql`
|
|||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
company {
|
company {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
xLink {
|
xLink {
|
||||||
label
|
label
|
||||||
@ -91,6 +95,7 @@ export const query = gql`
|
|||||||
activityTargets {
|
activityTargets {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
updatedAt
|
updatedAt
|
||||||
createdAt
|
createdAt
|
||||||
@ -105,7 +110,7 @@ export const query = gql`
|
|||||||
favorites {
|
favorites {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
__typename
|
||||||
id
|
id
|
||||||
companyId
|
companyId
|
||||||
createdAt
|
createdAt
|
||||||
@ -119,6 +124,7 @@ export const query = gql`
|
|||||||
attachments {
|
attachments {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
updatedAt
|
updatedAt
|
||||||
createdAt
|
createdAt
|
||||||
|
|||||||
@ -9,6 +9,7 @@ export const query = gql`
|
|||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,12 +22,14 @@ export const query = gql`
|
|||||||
pointOfContactForOpportunities {
|
pointOfContactForOpportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
company {
|
company {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
city
|
city
|
||||||
@ -34,6 +37,7 @@ export const query = gql`
|
|||||||
activityTargets {
|
activityTargets {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,6 +46,7 @@ export const query = gql`
|
|||||||
favorites {
|
favorites {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,6 +54,7 @@ export const query = gql`
|
|||||||
attachments {
|
attachments {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export const query = gql`
|
|||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,12 +20,14 @@ export const query = gql`
|
|||||||
pointOfContactForOpportunities {
|
pointOfContactForOpportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createdAt
|
createdAt
|
||||||
company {
|
company {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
city
|
city
|
||||||
@ -32,6 +35,7 @@ export const query = gql`
|
|||||||
activityTargets {
|
activityTargets {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,6 +44,7 @@ export const query = gql`
|
|||||||
favorites {
|
favorites {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,6 +52,7 @@ export const query = gql`
|
|||||||
attachments {
|
attachments {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export const query = gql`
|
|||||||
opportunities {
|
opportunities {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
__typename
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ describe('usePipelineSteps', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const boardColumn: BoardColumnDefinition = {
|
const boardColumn: BoardColumnDefinition = {
|
||||||
id: 'columnId',
|
id: mockId,
|
||||||
title: 'Column Title',
|
title: 'Column Title',
|
||||||
colorCode: 'yellow',
|
colorCode: 'yellow',
|
||||||
position: 1,
|
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user