mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Postgres Node): Falsy query parameters ignored (#10960)
This commit is contained in:
@@ -46,6 +46,9 @@ const createMockExecuteFunction = (nodeParameters: IDataObject) => {
|
||||
node.parameters = { ...node.parameters, ...(nodeParameters as INodeParameters) };
|
||||
return node;
|
||||
},
|
||||
evaluateExpression(str: string, _: number) {
|
||||
return str.replace('{{', '').replace('}}', '');
|
||||
},
|
||||
} as unknown as IExecuteFunctions;
|
||||
return fakeExecuteFunction;
|
||||
};
|
||||
@@ -290,6 +293,26 @@ describe('Test PostgresV2, executeQuery operation', () => {
|
||||
nodeOptions,
|
||||
);
|
||||
});
|
||||
|
||||
it('should call runQueries with falsy query replacements', async () => {
|
||||
const nodeParameters: IDataObject = {
|
||||
operation: 'executeQuery',
|
||||
query: 'SELECT *\nFROM users\nWHERE username IN ($1, $2, $3)',
|
||||
options: {
|
||||
queryReplacement: '={{ 0 }}, {{ null }}, {{ 0 }}',
|
||||
},
|
||||
};
|
||||
const nodeOptions = nodeParameters.options as IDataObject;
|
||||
|
||||
expect(async () => {
|
||||
await executeQuery.execute.call(
|
||||
createMockExecuteFunction(nodeParameters),
|
||||
runQueries,
|
||||
items,
|
||||
nodeOptions,
|
||||
);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test PostgresV2, insert operation', () => {
|
||||
|
||||
Reference in New Issue
Block a user