Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

56 lines
1.4 KiB
TypeScript

import { mockDeep } from 'jest-mock-extended';
import get from 'lodash/get';
import type { IExecuteFunctions } from 'n8n-workflow';
import * as getSchema from '../../../../v2/actions/base/getSchema.operation';
import * as transport from '../../../../v2/transport';
jest.mock('../../../../v2/transport', () => {
const originalModule = jest.requireActual('../../../../v2/transport');
return {
...originalModule,
apiRequest: jest.fn(async function () {
return { tables: [] };
}),
};
});
describe('Test AirtableV2, base => getSchema', () => {
it('should return all bases', async () => {
const nodeParameters = {
resource: 'base',
operation: 'getSchema',
base: {
value: '={{$json.id}}',
},
};
const items = [
{
json: { id: 'appYobase1' },
},
{
json: { id: 'appYobase2' },
},
];
await getSchema.execute.call(
mockDeep<IExecuteFunctions>({
getInputData: jest.fn(() => items),
getNodeParameter: jest.fn((param: string, itemIndex: number) => {
if (param === 'base') {
return items[itemIndex].json.id;
}
return get(nodeParameters, param);
}),
}),
items,
);
expect(transport.apiRequest).toBeCalledTimes(2);
expect(transport.apiRequest).toHaveBeenCalledWith('GET', 'meta/bases/appYobase1/tables');
expect(transport.apiRequest).toHaveBeenCalledWith('GET', 'meta/bases/appYobase2/tables');
});
});