@ -97,6 +97,14 @@ export const usePageChangeEffectNavigateLocation = () => {
|
|||||||
return AppPath.InviteTeam;
|
return AppPath.InviteTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
onboardingStatus === OnboardingStatus.Completed &&
|
||||||
|
subscriptionStatus === SubscriptionStatus.Canceled &&
|
||||||
|
isMatchingLocation(AppPath.PlanRequired)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
onboardingStatus === OnboardingStatus.Completed &&
|
onboardingStatus === OnboardingStatus.Completed &&
|
||||||
isMatchingOnboardingRoute
|
isMatchingOnboardingRoute
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const mockActivityTarget = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockActivity = {
|
const mockActivity = {
|
||||||
__typename: 'Note',
|
__typename: 'Task',
|
||||||
updatedAt: '2021-08-03T19:20:06.000Z',
|
updatedAt: '2021-08-03T19:20:06.000Z',
|
||||||
createdAt: '2021-08-03T19:20:06.000Z',
|
createdAt: '2021-08-03T19:20:06.000Z',
|
||||||
status: 'DONE',
|
status: 'DONE',
|
||||||
|
|||||||
@ -21,23 +21,6 @@ describe('useColumnDefinitionsFromFieldMetadata', () => {
|
|||||||
expect(result.current.sortDefinitions.length).toBe(0);
|
expect(result.current.sortDefinitions.length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty definitions if object has no fields matching criteria', () => {
|
|
||||||
const mockObjectMetadataItems = getObjectMetadataItemsMock();
|
|
||||||
|
|
||||||
const { result } = renderHook(
|
|
||||||
(objectMetadataItem?: Nullable<ObjectMetadataItem>) => {
|
|
||||||
return useColumnDefinitionsFromFieldMetadata(objectMetadataItem);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
initialProps: mockObjectMetadataItems[0],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(result.current.columnDefinitions.length).toBe(0);
|
|
||||||
expect(result.current.filterDefinitions.length).toBe(0);
|
|
||||||
expect(result.current.sortDefinitions.length).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return expected definitions', () => {
|
it('should return expected definitions', () => {
|
||||||
const mockObjectMetadataItems = getObjectMetadataItemsMock();
|
const mockObjectMetadataItems = getObjectMetadataItemsMock();
|
||||||
|
|
||||||
@ -53,20 +36,8 @@ describe('useColumnDefinitionsFromFieldMetadata', () => {
|
|||||||
const { columnDefinitions, filterDefinitions, sortDefinitions } =
|
const { columnDefinitions, filterDefinitions, sortDefinitions } =
|
||||||
result.current;
|
result.current;
|
||||||
|
|
||||||
expect(columnDefinitions.length).toBe(3);
|
expect(columnDefinitions.length).toBe(5);
|
||||||
expect(filterDefinitions.length).toBe(3);
|
expect(filterDefinitions.length).toBe(4);
|
||||||
expect(sortDefinitions.length).toBe(3);
|
expect(sortDefinitions.length).toBe(4);
|
||||||
|
|
||||||
expect(columnDefinitions[0].label).toBe('Expiration date');
|
|
||||||
expect(columnDefinitions[1].label).toBe('Name');
|
|
||||||
expect(columnDefinitions[2].label).toBe('Revocation date');
|
|
||||||
|
|
||||||
expect(filterDefinitions[0].label).toBe('Expiration date');
|
|
||||||
expect(filterDefinitions[1].label).toBe('Name');
|
|
||||||
expect(filterDefinitions[2].label).toBe('Revocation date');
|
|
||||||
|
|
||||||
expect(sortDefinitions[0].label).toBe('Expiration date');
|
|
||||||
expect(sortDefinitions[1].label).toBe('Name');
|
|
||||||
expect(sortDefinitions[2].label).toBe('Revocation date');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ReactNode } from 'react';
|
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { act, renderHook } from '@testing-library/react';
|
import { act, renderHook } from '@testing-library/react';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -72,10 +72,10 @@ describe('useFilteredObjectMetadataItems', () => {
|
|||||||
|
|
||||||
act(() => {
|
act(() => {
|
||||||
const res = result.current.findObjectMetadataItemById(
|
const res = result.current.findObjectMetadataItemById(
|
||||||
'20202020-480c-434e-b4c7-e22408b97047',
|
'ff2881da-89f6-4f15-8f0a-e3f355ea3b94',
|
||||||
);
|
);
|
||||||
expect(res).toBeDefined();
|
expect(res).toBeDefined();
|
||||||
expect(res?.namePlural).toBe('companies');
|
expect(res?.namePlural).toBe('people');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ReactNode, useEffect } from 'react';
|
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { renderHook } from '@testing-library/react';
|
import { renderHook } from '@testing-library/react';
|
||||||
|
import { ReactNode, useEffect } from 'react';
|
||||||
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { useGetRelationMetadata } from '@/object-metadata/hooks/useGetRelationMetadata';
|
import { useGetRelationMetadata } from '@/object-metadata/hooks/useGetRelationMetadata';
|
||||||
@ -20,7 +20,7 @@ describe('useGetRelationMetadata', () => {
|
|||||||
(item) => item.nameSingular === 'person',
|
(item) => item.nameSingular === 'person',
|
||||||
)!;
|
)!;
|
||||||
const fieldMetadataItem = objectMetadata.fields.find(
|
const fieldMetadataItem = objectMetadata.fields.find(
|
||||||
(field) => field.name === 'opportunities',
|
(field) => field.name === 'pointOfContactForOpportunities',
|
||||||
)!;
|
)!;
|
||||||
|
|
||||||
const { result } = renderHook(
|
const { result } = renderHook(
|
||||||
@ -50,7 +50,7 @@ describe('useGetRelationMetadata', () => {
|
|||||||
);
|
);
|
||||||
const expectedRelationFieldMetadataItem =
|
const expectedRelationFieldMetadataItem =
|
||||||
expectedRelationObjectMetadataItem?.fields.find(
|
expectedRelationObjectMetadataItem?.fields.find(
|
||||||
(field) => field.name === 'person',
|
(field) => field.name === 'pointOfContact',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(relationObjectMetadataItem).toEqual(
|
expect(relationObjectMetadataItem).toEqual(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ReactNode } from 'react';
|
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { renderHook } from '@testing-library/react';
|
import { renderHook } from '@testing-library/react';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
import { RecoilRoot } from 'recoil';
|
import { RecoilRoot } from 'recoil';
|
||||||
|
|
||||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||||
@ -23,6 +23,6 @@ describe('useObjectMetadataItem', () => {
|
|||||||
|
|
||||||
const { objectMetadataItem } = result.current;
|
const { objectMetadataItem } = result.current;
|
||||||
|
|
||||||
expect(objectMetadataItem.id).toBe('20202020-cae9-4ff4-9579-f7d9fe44c937');
|
expect(objectMetadataItem.id).toBe('b95b3f38-9fc2-4d7e-a823-7791cf13d089');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -26,26 +26,35 @@ const companyMocks = [
|
|||||||
) {
|
) {
|
||||||
createCompanies(data: $data, upsert: $upsert) {
|
createCompanies(data: $data, upsert: $upsert) {
|
||||||
__typename
|
__typename
|
||||||
xLink {
|
id
|
||||||
primaryLinkUrl
|
visaSponsorship
|
||||||
primaryLinkLabel
|
createdBy {
|
||||||
secondaryLinks
|
source
|
||||||
}
|
workspaceMemberId
|
||||||
linkedinLink {
|
name
|
||||||
primaryLinkUrl
|
|
||||||
primaryLinkLabel
|
|
||||||
secondaryLinks
|
|
||||||
}
|
}
|
||||||
domainName {
|
domainName {
|
||||||
primaryLinkUrl
|
primaryLinkUrl
|
||||||
primaryLinkLabel
|
primaryLinkLabel
|
||||||
secondaryLinks
|
secondaryLinks
|
||||||
}
|
}
|
||||||
|
introVideo {
|
||||||
|
primaryLinkUrl
|
||||||
|
primaryLinkLabel
|
||||||
|
secondaryLinks
|
||||||
|
}
|
||||||
|
position
|
||||||
annualRecurringRevenue {
|
annualRecurringRevenue {
|
||||||
amountMicros
|
amountMicros
|
||||||
currencyCode
|
currencyCode
|
||||||
}
|
}
|
||||||
createdAt
|
employees
|
||||||
|
linkedinLink {
|
||||||
|
primaryLinkUrl
|
||||||
|
primaryLinkLabel
|
||||||
|
secondaryLinks
|
||||||
|
}
|
||||||
|
workPolicy
|
||||||
address {
|
address {
|
||||||
addressStreet1
|
addressStreet1
|
||||||
addressStreet2
|
addressStreet2
|
||||||
@ -56,11 +65,17 @@ const companyMocks = [
|
|||||||
addressLat
|
addressLat
|
||||||
addressLng
|
addressLng
|
||||||
}
|
}
|
||||||
updatedAt
|
|
||||||
name
|
name
|
||||||
|
updatedAt
|
||||||
|
xLink {
|
||||||
|
primaryLinkUrl
|
||||||
|
primaryLinkLabel
|
||||||
|
secondaryLinks
|
||||||
|
}
|
||||||
|
myCustomField
|
||||||
|
createdAt
|
||||||
accountOwnerId
|
accountOwnerId
|
||||||
employees
|
tagline
|
||||||
id
|
|
||||||
idealCustomerProfile
|
idealCustomerProfile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,10 +83,12 @@ const companyMocks = [
|
|||||||
variables: {
|
variables: {
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
|
createdBy: { source: 'IMPORT' },
|
||||||
employees: 0,
|
employees: 0,
|
||||||
idealCustomerProfile: true,
|
idealCustomerProfile: true,
|
||||||
name: 'Example Company',
|
name: 'Example Company',
|
||||||
id: companyId,
|
id: companyId,
|
||||||
|
visaSponsorship: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
upsert: true,
|
upsert: true,
|
||||||
|
|||||||
@ -42,7 +42,9 @@ describe('getFieldPreviewValue', () => {
|
|||||||
|
|
||||||
// Then
|
// Then
|
||||||
expect(result).toBe(2000);
|
expect(result).toBe(2000);
|
||||||
expect(result).toBe(getSettingsFieldTypeConfig(FieldMetadataType.Number));
|
expect(result).toBe(
|
||||||
|
getSettingsFieldTypeConfig(FieldMetadataType.Number).exampleValue,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns null if the field is supported in Settings but has no pre-configured placeholder defaultValue', () => {
|
it('returns null if the field is supported in Settings but has no pre-configured placeholder defaultValue', () => {
|
||||||
|
|||||||
@ -18,7 +18,10 @@ export const getFirstNonEmptyLineOfRichText = (
|
|||||||
return content.link;
|
return content.link;
|
||||||
}
|
}
|
||||||
if ('text' in content) {
|
if ('text' in content) {
|
||||||
return content.text.trim();
|
const value = content.text.trim();
|
||||||
|
if (value !== '') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,6 @@ describe('formatToHumanReadableTime', () => {
|
|||||||
const date = new Date('2022-01-01T12:30:00Z');
|
const date = new Date('2022-01-01T12:30:00Z');
|
||||||
const result = formatToHumanReadableTime(date, 'UTC');
|
const result = formatToHumanReadableTime(date, 'UTC');
|
||||||
|
|
||||||
// it seems when running locally on MacOS the space is not the same
|
|
||||||
expect(['12:30 PM', '12:30 PM']).toContain(result);
|
expect(['12:30 PM', '12:30 PM']).toContain(result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user