mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(Google BigQuery Node): Send timeoutMs in query, pagination support (#10205)
This commit is contained in:
@@ -10,7 +10,7 @@ jest.mock('../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
googleApiRequest: jest.fn(async (method: IHttpRequestMethods, resource: string) => {
|
||||
googleBigQueryApiRequest: jest.fn(async (method: IHttpRequestMethods, resource: string) => {
|
||||
if (resource === '/v2/projects/test-project/jobs' && method === 'POST') {
|
||||
return {
|
||||
jobReference: {
|
||||
@@ -25,7 +25,7 @@ jest.mock('../../../v2/transport', () => {
|
||||
return {};
|
||||
}
|
||||
}),
|
||||
// googleApiRequestAllItems: jest.fn(async () => {}),
|
||||
googleBigQueryApiRequestAllItems: jest.fn(async () => ({ rows: [], schema: {} })),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -47,8 +47,9 @@ describe('Test Google BigQuery V2, executeQuery', () => {
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledTimes(1);
|
||||
expect(transport.googleBigQueryApiRequestAllItems).toHaveBeenCalledTimes(1);
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/v2/projects/test-project/jobs',
|
||||
{
|
||||
@@ -60,11 +61,11 @@ describe('Test Google BigQuery V2, executeQuery', () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
expect(transport.googleBigQueryApiRequestAllItems).toHaveBeenCalledWith(
|
||||
'GET',
|
||||
'/v2/projects/test-project/queries/job_123',
|
||||
undefined,
|
||||
{},
|
||||
{ location: undefined, maxResults: 1000, timeoutMs: 10000 },
|
||||
);
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
|
||||
@@ -10,7 +10,7 @@ jest.mock('../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
googleApiRequest: jest.fn(async (method: IHttpRequestMethods, resource: string) => {
|
||||
googleBigQueryApiRequest: jest.fn(async (method: IHttpRequestMethods, resource: string) => {
|
||||
if (
|
||||
resource ===
|
||||
'/v2/projects/test-project/datasets/bigquery_node_dev_test_dataset/tables/num_text' &&
|
||||
@@ -55,13 +55,13 @@ describe('Test Google BigQuery V2, insert auto map', () => {
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledWith(
|
||||
'GET',
|
||||
'/v2/projects/test-project/datasets/bigquery_node_dev_test_dataset/tables/num_text',
|
||||
{},
|
||||
);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/v2/projects/test-project/datasets/bigquery_node_dev_test_dataset/tables/num_text/insertAll',
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ jest.mock('../../../v2/transport', () => {
|
||||
const originalModule = jest.requireActual('../../../v2/transport');
|
||||
return {
|
||||
...originalModule,
|
||||
googleApiRequest: jest.fn(async (method: IHttpRequestMethods, resource: string) => {
|
||||
googleBigQueryApiRequest: jest.fn(async (method: IHttpRequestMethods, resource: string) => {
|
||||
if (
|
||||
resource ===
|
||||
'/v2/projects/test-project/datasets/bigquery_node_dev_test_dataset/tables/test_json' &&
|
||||
@@ -56,13 +56,13 @@ describe('Test Google BigQuery V2, insert define manually', () => {
|
||||
const testNode = async (testData: WorkflowTestData, types: INodeTypes) => {
|
||||
const { result } = await executeWorkflow(testData, types);
|
||||
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledTimes(2);
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledWith(
|
||||
'GET',
|
||||
'/v2/projects/test-project/datasets/bigquery_node_dev_test_dataset/tables/test_json',
|
||||
{},
|
||||
);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
expect(transport.googleBigQueryApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/v2/projects/test-project/datasets/bigquery_node_dev_test_dataset/tables/test_json/insertAll',
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user