mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(Code Node): Ensure 'Generate Code' works with empty input object (#14352)
This commit is contained in:
@@ -167,8 +167,9 @@ return []
|
||||
const askAiReq = cy.wait('@ask-ai');
|
||||
|
||||
askAiReq.its('request.body').should('have.keys', ['question', 'context', 'forNode']);
|
||||
|
||||
askAiReq.its('context').should('have.keys', ['schema', 'ndvPushRef', 'pushRef']);
|
||||
askAiReq
|
||||
.its('context')
|
||||
.should('have.keys', ['schema', 'ndvPushRef', 'pushRef', 'inputSchema']);
|
||||
|
||||
cy.contains('Code generation completed').should('be.visible');
|
||||
cy.getByTestId('code-node-tab-code').should('contain.text', 'console.log("Hello World")');
|
||||
|
||||
@@ -106,7 +106,11 @@ function getSchemas() {
|
||||
})
|
||||
.filter((node) => node.schema?.value.length > 0);
|
||||
|
||||
const inputSchema = parentNodesSchemas.shift();
|
||||
// Account for empty objects
|
||||
const inputSchema = parentNodesSchemas.shift() ?? {
|
||||
nodeName: parentNodesNames[0] ?? '',
|
||||
schema: { path: '', type: 'undefined', value: '' },
|
||||
};
|
||||
|
||||
return {
|
||||
parentNodesNames,
|
||||
@@ -161,7 +165,7 @@ async function onSubmit() {
|
||||
question: prompt.value,
|
||||
context: {
|
||||
schema: schemas.parentNodesSchemas,
|
||||
inputSchema: schemas.inputSchema!,
|
||||
inputSchema: schemas.inputSchema,
|
||||
ndvPushRef: useNDVStore().pushRef,
|
||||
pushRef: rootStore.pushRef,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user