Files
twenty_crm/packages/twenty-zapier/src/test/utils/handleQueryParams.test.ts
Marie 34d13a7b58 Deprecate address standard field (#6087)
Closes #5916

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-07-10 18:07:18 +02:00

36 lines
1.2 KiB
TypeScript

import handleQueryParams from '../../utils/handleQueryParams';
describe('utils.handleQueryParams', () => {
test('should handle empty values', () => {
const inputData = {};
const result = handleQueryParams(inputData);
const expectedResult = '';
expect(result).toEqual(expectedResult);
});
test('should format', () => {
const inputData = {
name: 'Company Name',
address: { addressCity: 'Paris' },
domainName: 'Company Domain Name',
linkedinUrl__url: '/linkedin_url',
linkedinUrl__label: 'Test linkedinUrl',
xUrl__url: '/x_url',
xUrl__label: 'Test xUrl',
annualRecurringRevenue: 100000,
idealCustomerProfile: true,
employees: 25,
};
const result = handleQueryParams(inputData);
const expectedResult =
'name: "Company Name", ' +
'address: { addressCity: "Paris" }, ' +
'domainName: "Company Domain Name", ' +
'linkedinUrl: {url: "/linkedin_url", label: "Test linkedinUrl"}, ' +
'xUrl: {url: "/x_url", label: "Test xUrl"}, ' +
'annualRecurringRevenue: 100000, ' +
'idealCustomerProfile: true, ' +
'employees: 25';
expect(result).toEqual(expectedResult);
});
});