Skip to content

Commit

Permalink
NodeExecutionOutput type test
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency committed May 13, 2024
1 parent 75704a7 commit ba140ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion packages/core/test/WorkflowExecute.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { IRun, WorkflowTestData } from 'n8n-workflow';
import { ApplicationError, createDeferredPromise, Workflow } from 'n8n-workflow';
import {
ApplicationError,
createDeferredPromise,
NodeExecutionOutput,
Workflow,
} from 'n8n-workflow';
import { WorkflowExecute } from '@/WorkflowExecute';

import * as Helpers from './helpers';
Expand Down Expand Up @@ -192,4 +197,16 @@ describe('WorkflowExecute', () => {
});
}
});

describe('WorkflowExecute, NodeExecutionOutput type test', () => {
//TODO Add more tests here when execution hints are added to some node types
const nodeExecutionOutput = new NodeExecutionOutput(
[[{ json: { data: 123 } }]],
[{ message: 'TEXT HINT' }],
);

expect(nodeExecutionOutput).toBeInstanceOf(NodeExecutionOutput);
expect(nodeExecutionOutput[0][0].json.data).toEqual(123);
expect(nodeExecutionOutput.getHints()[0].message).toEqual('TEXT HINT');
});
});
4 changes: 2 additions & 2 deletions packages/workflow/test/NodeHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3463,7 +3463,7 @@ describe('NodeHelpers', () => {
expect(hints).toHaveLength(1);
expect(hints[0].message).toEqual('TEST HINT');
});
test('should not include hint id displayCondition false', () => {
test('should not include hint if displayCondition is false', () => {
const testType = {
hints: [
{
Expand Down Expand Up @@ -3495,7 +3495,7 @@ describe('NodeHelpers', () => {

expect(hints).toHaveLength(0);
});
test('should include hint id displayCondition true', () => {
test('should include hint if displayCondition is true', () => {
const testType = {
hints: [
{
Expand Down

0 comments on commit ba140ca

Please sign in to comment.