2248 zapier integration implement typeorm eventsubscribers (#3122)
* Add new queue to twenty-server * Add triggers to zapier * Rename webhook operation * Use find one or fail * Use logger * Fix typescript templating * Add dedicated call webhook job * Update logging * Fix error handling
This commit is contained in:
@ -1,25 +1,29 @@
|
||||
import App from '../../index';
|
||||
import getBundle from "../../utils/getBundle";
|
||||
import { Bundle, createAppTester, tools, ZObject } from "zapier-platform-core";
|
||||
import requestDb from "../../utils/requestDb";
|
||||
import getBundle from '../../utils/getBundle';
|
||||
import { Bundle, createAppTester, tools, ZObject } from 'zapier-platform-core';
|
||||
import requestDb from '../../utils/requestDb';
|
||||
import { createRecordKey } from '../../creates/create_record';
|
||||
const appTester = createAppTester(App);
|
||||
tools.env.inject;
|
||||
tools.env.inject();
|
||||
|
||||
describe('creates.create_record', () => {
|
||||
describe('creates.[createRecordKey]', () => {
|
||||
test('should run to create a Company Record', async () => {
|
||||
const bundle = getBundle({
|
||||
nameSingular: 'Company',
|
||||
name: 'Company Name',
|
||||
address: 'Company Address',
|
||||
domainName: 'Company Domain Name',
|
||||
linkedinLink: {url: '/linkedin_url', label: "Test linkedinUrl"},
|
||||
xLink: {url: '/x_url', label: "Test xUrl"},
|
||||
annualRecurringRevenue: {amountMicros:100000000000,currencyCode: 'USD'},
|
||||
linkedinLink: { url: '/linkedin_url', label: 'Test linkedinUrl' },
|
||||
xLink: { url: '/x_url', label: 'Test xUrl' },
|
||||
annualRecurringRevenue: {
|
||||
amountMicros: 100000000000,
|
||||
currencyCode: 'USD',
|
||||
},
|
||||
idealCustomerProfile: true,
|
||||
employees: 25,
|
||||
});
|
||||
const result = await appTester(
|
||||
App.creates.create_record.operation.perform,
|
||||
App.creates[createRecordKey].operation.perform,
|
||||
bundle,
|
||||
);
|
||||
expect(result).toBeDefined();
|
||||
@ -33,20 +37,20 @@ describe('creates.create_record', () => {
|
||||
),
|
||||
bundle,
|
||||
);
|
||||
expect(checkDbResult.data.company.annualRecurringRevenue.amountMicros).toEqual(
|
||||
100000000000,
|
||||
);
|
||||
})
|
||||
expect(
|
||||
checkDbResult.data.company.annualRecurringRevenue.amountMicros,
|
||||
).toEqual(100000000000);
|
||||
});
|
||||
test('should run to create a Person Record', async () => {
|
||||
const bundle = getBundle({
|
||||
nameSingular: 'Person',
|
||||
name: {firstName: 'John', lastName: 'Doe'},
|
||||
name: { firstName: 'John', lastName: 'Doe' },
|
||||
email: 'johndoe@gmail.com',
|
||||
phone: '+33610203040',
|
||||
city: 'Paris',
|
||||
});
|
||||
const result = await appTester(
|
||||
App.creates.create_record.operation.perform,
|
||||
App.creates[createRecordKey].operation.perform,
|
||||
bundle,
|
||||
);
|
||||
expect(result).toBeDefined();
|
||||
@ -61,5 +65,5 @@ describe('creates.create_record', () => {
|
||||
bundle,
|
||||
);
|
||||
expect(checkDbResult.data.person.phone).toEqual('+33610203040');
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user