2052 zapier integration 5 deploy twenty zapier app into the public repository (#2101)

* Add create_company Zap action

* Add testing for that action

* Core review returns
This commit is contained in:
martmull
2023-10-18 17:56:40 +02:00
committed by GitHub
parent 547a17b145
commit 51a06b3ebd
11 changed files with 334 additions and 60 deletions

View File

@ -5,8 +5,8 @@ import {
createAppTester,
tools,
ZObject,
AppError,
} from 'zapier-platform-core';
import getBundle from '../utils/getBundle';
const appTester = createAppTester(App);
tools.env.inject();
@ -36,7 +36,7 @@ const apiKey = String(process.env.API_KEY);
describe('custom auth', () => {
it('passes authentication and returns json', async () => {
const bundle = { authData: { apiKey } };
const bundle = getBundle();
const response = await appTester(App.authentication.test, bundle);
expect(response.data).toHaveProperty('currentWorkspace');
expect(response.data.currentWorkspace).toHaveProperty('displayName');
@ -55,10 +55,10 @@ describe('custom auth', () => {
});
it('fails on invalid auth token', async () => {
const bundle = {
authData: { apiKey },
inputData: { name: 'Test', expiresAt: '2020-01-01 10:10:10.000' },
};
const bundle = getBundle({
name: 'Test',
expiresAt: '2020-01-01 10:10:10.000',
});
const expiredToken = await appTester(generateKey, bundle);
const bundleWithExpiredApiKey = {
authData: { apiKey: expiredToken },