mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
* ⚡ setup * ⚡ finished v2 setup * ⚡ fix return all, fix simplify with nested schema * ⚡ fix for external tables, updated scopes * ⚡ query operation * ⚡ linter fixes * ⚡ fixed not processed errors when inserting, move main loop to execute function to allow bulk request * ⚡ customizible batch size when inserting, improoved errors * ⚡ options for mapping input * ⚡ fix for inserting RECORD type * ⚡ updated simplify logic * ⚡ fix for return with selected fields * ⚡ option to return table schema * ⚡ linter fixes * ⚡ fix imports * ⚡ query resource and fixes, rlc for projects * ⚡ removed simplify, added raw output option * ⚡ rlc for tables and datasets, no urls option * ⚡ updated hints and description of query parameter, fix getMany VIEW, multioptions fo fields * ⚡ added case when rows are empty * ⚡ linter fixes * ⚡ UI update, one resource * ⚡ fix for output with field named json * ⚡ using jobs instead queries * ⚡ added error message * ⚡ search for RLCs, fixes * ⚡ json processing * ⚡ removed getAll operation * ⚡ executeQuery update * ⚡ unit test * ⚡ tests setup, fixes * ⚡ tests * Remove script for checking unused loadOptions --------- Co-authored-by: agobrech <ael.gobrecht@gmail.com>
266 lines
5.0 KiB
TypeScript
266 lines
5.0 KiB
TypeScript
import type { IDataObject } from 'n8n-workflow';
|
|
import { prepareOutput } from '../../../v2/helpers/utils';
|
|
|
|
describe('Google BigQuery v2 Utils', () => {
|
|
it('should prepareOutput', () => {
|
|
const response: IDataObject = {
|
|
kind: 'bigquery#getQueryResultsResponse',
|
|
etag: 'e_tag',
|
|
schema: {
|
|
fields: [
|
|
{
|
|
name: 'nodes',
|
|
type: 'RECORD',
|
|
mode: 'REPEATED',
|
|
fields: [
|
|
{
|
|
name: 'webhookId',
|
|
type: 'STRING',
|
|
mode: 'NULLABLE',
|
|
},
|
|
{
|
|
name: 'position',
|
|
type: 'INTEGER',
|
|
mode: 'REPEATED',
|
|
},
|
|
{
|
|
name: 'name',
|
|
type: 'STRING',
|
|
mode: 'NULLABLE',
|
|
},
|
|
{
|
|
name: 'typeVersion',
|
|
type: 'INTEGER',
|
|
mode: 'NULLABLE',
|
|
},
|
|
{
|
|
name: 'credentials',
|
|
type: 'RECORD',
|
|
mode: 'NULLABLE',
|
|
fields: [
|
|
{
|
|
name: 'zendeskApi',
|
|
type: 'RECORD',
|
|
mode: 'NULLABLE',
|
|
fields: [
|
|
{
|
|
name: 'name',
|
|
type: 'STRING',
|
|
mode: 'NULLABLE',
|
|
},
|
|
{
|
|
name: 'id',
|
|
type: 'INTEGER',
|
|
mode: 'NULLABLE',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'type',
|
|
type: 'STRING',
|
|
mode: 'NULLABLE',
|
|
},
|
|
{
|
|
name: 'parameters',
|
|
type: 'RECORD',
|
|
mode: 'NULLABLE',
|
|
fields: [
|
|
{
|
|
name: 'conditions',
|
|
type: 'RECORD',
|
|
mode: 'NULLABLE',
|
|
fields: [
|
|
{
|
|
name: 'all',
|
|
type: 'RECORD',
|
|
mode: 'REPEATED',
|
|
fields: [
|
|
{
|
|
name: 'value',
|
|
type: 'STRING',
|
|
mode: 'NULLABLE',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'options',
|
|
type: 'RECORD',
|
|
mode: 'NULLABLE',
|
|
fields: [
|
|
{
|
|
name: 'fields',
|
|
type: 'STRING',
|
|
mode: 'REPEATED',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
jobReference: {
|
|
projectId: 'project_id',
|
|
jobId: 'job_ref',
|
|
location: 'US',
|
|
},
|
|
totalRows: '1',
|
|
rows: [
|
|
{
|
|
f: [
|
|
{
|
|
v: [
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: 'web_hook_id',
|
|
},
|
|
{
|
|
v: [
|
|
{
|
|
v: '100',
|
|
},
|
|
{
|
|
v: '100',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
v: 'Zendesk Trigger',
|
|
},
|
|
{
|
|
v: '1',
|
|
},
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: 'Zendesk account',
|
|
},
|
|
{
|
|
v: '8',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
v: 'n8n-nodes-base.zendeskTrigger',
|
|
},
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: [
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: 'closed',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
v: {
|
|
f: [
|
|
{
|
|
v: [
|
|
{
|
|
v: 'ticket.title',
|
|
},
|
|
{
|
|
v: 'ticket.description',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
totalBytesProcessed: '0',
|
|
jobComplete: true,
|
|
cacheHit: true,
|
|
};
|
|
const returnData = prepareOutput(response, 0, false, false);
|
|
|
|
expect(returnData).toBeDefined();
|
|
// expect(returnData).toHaveProperty('nodes');
|
|
expect(returnData).toEqual([
|
|
{
|
|
json: {
|
|
nodes: [
|
|
{
|
|
webhookId: 'web_hook_id',
|
|
position: ['100', '100'],
|
|
name: 'Zendesk Trigger',
|
|
typeVersion: '1',
|
|
credentials: [
|
|
{
|
|
zendeskApi: [
|
|
{
|
|
name: 'Zendesk account',
|
|
id: '8',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
type: 'n8n-nodes-base.zendeskTrigger',
|
|
parameters: [
|
|
{
|
|
conditions: [
|
|
{
|
|
all: [
|
|
{
|
|
value: 'closed',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
options: [
|
|
{
|
|
fields: ['ticket.title', 'ticket.description'],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
pairedItem: {
|
|
item: 0,
|
|
},
|
|
},
|
|
]);
|
|
});
|
|
});
|