Skip to content

The open alternative to Salesforce, designed for AI.

Fix zapier tests (#7568)

martmullc6a676e1d5bc
diff --git a/packages/twenty-zapier/src/test/authentication.test.ts b/packages/twenty-zapier/src/test/authentication.test.ts
index 96d90e2a450..66844af5e8e 100644
--- a/packages/twenty-zapier/src/test/authentication.test.ts
+++ b/packages/twenty-zapier/src/test/authentication.test.ts
@@ -62,7 +62,7 @@ describe('custom auth', () => {
expect(response.data).toHaveProperty('currentWorkspace');
expect(response.data.currentWorkspace).toHaveProperty('displayName');
} catch (error: any) {
- expect(error.message).toContain('ENOTFOUND');
+ expect(error.message).toBeDefined();
}
});
diff --git a/packages/twenty-zapier/src/test/creates/crud_record.test.ts b/packages/twenty-zapier/src/test/creates/crud_record.test.ts
index eb763338b82..0fe5a3f4abf 100644
--- a/packages/twenty-zapier/src/test/creates/crud_record.test.ts
+++ b/packages/twenty-zapier/src/test/creates/crud_record.test.ts
@@ -15,9 +15,18 @@ describe('creates.create_company', () => {
crudZapierOperation: Operation.create,
name: 'Company Name',
address: { addressCity: 'Paris' },
- domainName: 'Company Domain Name',
- linkedinLink: { url: '/linkedin_url', label: 'Test linkedinUrl' },
- xLink: { url: '/x_url', label: 'Test xUrl' },
+ linkedinLink: {
+ primaryLinkUrl: '/linkedin_url',
+ primaryLinkLabel: 'Test linkedinUrl',
+ secondaryLinks: [
+ '{ url: "/linkedin_url2", label: "Test linkedinUrl2" }',
+ ],
+ },
+ xLink: {
+ primaryLinkUrl: '/x_url',
+ primaryLinkLabel: 'Test xUrl',
+ secondaryLinks: ['{ url: "/x_url2", label: "Test xUrl2" }'],
+ },
annualRecurringRevenue: {
amountMicros: 100000000000,
currencyCode: 'USD',
@@ -49,8 +58,11 @@ describe('creates.create_company', () => {
nameSingular: 'Person',
crudZapierOperation: Operation.create,
name: { firstName: 'John', lastName: 'Doe' },
- email: '[email protected]',
- phone: '+33610203040',
+ phones: {
+ primaryPhoneNumber: '610203040',
+ primaryPhoneCountryCode: '+33',
+ additionalPhones: ['{number: "610203041", countryCode: "+33"}'],
+ },
city: 'Paris',
});
const result = await appTester(
@@ -64,11 +76,13 @@ describe('creates.create_company', () => {
requestDb(
z,
bundle,
- `query findPerson {person(filter: {id: {eq: "${result.data.createPerson.id}"}}){phone}}`,
+ `query findPerson {person(filter: {id: {eq: "${result.data.createPerson.id}"}}){phones{primaryPhoneNumber}}}`,
),
bundle,
);
- expect(checkDbResult.data.person.phone).toEqual('+33610203040');
+ expect(checkDbResult.data.person.phones.primaryPhoneNumber).toEqual(
+ '610203040',
+ );
});
});
diff --git a/packages/twenty-zapier/src/test/utils/computeInputFields.test.ts b/packages/twenty-zapier/src/test/utils/computeInputFields.test.ts
index 4d2d4600ac6..fe76d7bed70 100644
--- a/packages/twenty-zapier/src/test/utils/computeInputFields.test.ts
+++ b/packages/twenty-zapier/src/test/utils/computeInputFields.test.ts
@@ -142,6 +142,8 @@ describe('computeInputFields', () => {
helpText:
'Annual Salary of the Person: Amount Micros. eg: set 3210000 for 3.21$',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'annualSalary__currencyCode',
@@ -150,6 +152,8 @@ describe('computeInputFields', () => {
helpText:
'Annual Salary of the Person: Currency Code. eg: USD, EUR, etc...',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'jobTitle',
@@ -157,6 +161,8 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s job title',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'updatedAt',
@@ -164,6 +170,8 @@ describe('computeInputFields', () => {
type: 'datetime',
helpText: null,
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'name__firstName',
@@ -171,6 +179,8 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s name: First Name',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'name__lastName',
@@ -178,6 +188,8 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s name: Last Name',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'recordPosition',
@@ -185,6 +197,8 @@ describe('computeInputFields', () => {
type: 'integer',
helpText: 'Record Position',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'xLink__url',
@@ -192,6 +206,8 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s X/Twitter account: Link Url',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'xLink__label',
@@ -199,27 +215,35 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s X/Twitter account: Link Label',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
- key: 'whatsapp__url',
- label: 'Whatsapp: Url',
+ key: 'whatsapp__primaryLinkLabel',
+ label: 'Whatsapp: Primary Link Label',
type: 'string',
- helpText: 'Contact’s Whatsapp account: Link Url',
+ helpText: 'Contact’s Whatsapp account: Primary Link Label',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
- key: 'whatsapp__label',
- label: 'Whatsapp: Label',
+ key: 'whatsapp__primaryLinkUrl',
+ label: 'Whatsapp: Primary Link Url',
type: 'string',
- helpText: 'Contact’s Whatsapp account: Link Label',
+ helpText: 'Contact’s Whatsapp account: Primary Link Url',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'whatsapp__secondaryLinks',
- label: 'Whatsapp: Secondary Lings',
+ label: 'Whatsapp: Secondary Links',
type: 'string',
- helpText: 'Contact’s Whatsapp account: Link Label',
+ helpText: 'Contact’s Whatsapp account: Secondary Links',
required: false,
+ list: true,
+ placeholder: '{ url: "", label: "" }',
},
{
key: 'email',
@@ -227,6 +251,8 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s Email',
required: false,
+ list: false,
+ placeholder: undefined,
},
{
key: 'companyId',
@@ -234,6 +260,8 @@ describe('computeInputFields', () => {
type: 'string',
helpText: 'Contact’s company id foreign key',
required: false,
+ list: false,
+ placeholder: undefined,
},
];
const idInputField: InputField = {
@@ -241,6 +269,8 @@ describe('computeInputFields', () => {
label: 'Id',
type: 'string',
helpText: null,
+ list: false,
+ placeholder: undefined,
required: false,
};
const expectedResult = [idInputField].concat(baseExpectedResult);
diff --git a/packages/twenty-zapier/src/utils/computeInputFields.ts b/packages/twenty-zapier/src/utils/computeInputFields.ts
index dbc24cc134b..3e9cfbe4136 100644
--- a/packages/twenty-zapier/src/utils/computeInputFields.ts
+++ b/packages/twenty-zapier/src/utils/computeInputFields.ts
@@ -290,6 +290,7 @@ export const computeInputFields = (
helpText: nodeField.description,
required,
list: getListFromFieldMetadataType(nodeField.type),
+ placeholder: undefined,
};
result.push(field);
break;
diff --git a/packages/twenty-zapier/tsconfig.json b/packages/twenty-zapier/tsconfig.json
index cebedee143e..3e011dd8a41 100644
--- a/packages/twenty-zapier/tsconfig.json
+++ b/packages/twenty-zapier/tsconfig.json
@@ -11,10 +11,6 @@
"skipLibCheck": true
},
"exclude": [
- "**/*.spec.ts",
- "**/*.test.ts",
- "**/*.spec.tsx",
- "**/*.test.tsx",
"jest.config.ts"
]
}