feat(Airtable Node): Overhaul (#6200)

This commit is contained in:
Michael Kret
2023-07-17 19:42:30 +03:00
committed by GitHub
parent fc8ed55c0d
commit b69d20c12e
42 changed files with 3989 additions and 871 deletions

View File

@@ -0,0 +1,48 @@
import nock from 'nock';
import * as getSchema from '../../../../v2/actions/base/getSchema.operation';
import * as transport from '../../../../v2/transport';
import { createMockExecuteFunction } from '../helpers';
jest.mock('../../../../v2/transport', () => {
const originalModule = jest.requireActual('../../../../v2/transport');
return {
...originalModule,
apiRequest: jest.fn(async function () {
return {};
}),
};
});
describe('Test AirtableV2, base => getSchema', () => {
beforeAll(() => {
nock.disableNetConnect();
});
afterAll(() => {
nock.restore();
jest.unmock('../../../../v2/transport');
});
it('should return all bases', async () => {
const nodeParameters = {
resource: 'base',
operation: 'getSchema',
base: {
value: 'appYobase',
},
};
const items = [
{
json: {},
},
];
await getSchema.execute.call(createMockExecuteFunction(nodeParameters), items);
expect(transport.apiRequest).toBeCalledTimes(1);
expect(transport.apiRequest).toHaveBeenCalledWith('GET', 'meta/bases/appYobase/tables');
});
});