mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
trigger node test
This commit is contained in:
parent
c4bd0f0b0b
commit
ccca4c4e90
|
@ -9,7 +9,7 @@ import {
|
||||||
defaultNodeDescriptions,
|
defaultNodeDescriptions,
|
||||||
mockNodeTypeDescription,
|
mockNodeTypeDescription,
|
||||||
} from '@/__tests__/mocks';
|
} from '@/__tests__/mocks';
|
||||||
import { IF_NODE_TYPE, SET_NODE_TYPE } from '@/constants';
|
import { IF_NODE_TYPE, SET_NODE_TYPE, MANUAL_TRIGGER_NODE_TYPE } from '@/constants';
|
||||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||||
import { mock } from 'vitest-mock-extended';
|
import { mock } from 'vitest-mock-extended';
|
||||||
import type { IWorkflowDb } from '@/Interface';
|
import type { IWorkflowDb } from '@/Interface';
|
||||||
|
@ -17,8 +17,8 @@ import { NodeConnectionType, type IDataObject } from 'n8n-workflow';
|
||||||
import * as nodeHelpers from '@/composables/useNodeHelpers';
|
import * as nodeHelpers from '@/composables/useNodeHelpers';
|
||||||
|
|
||||||
const mockNode1 = createTestNode({
|
const mockNode1 = createTestNode({
|
||||||
name: 'Set1',
|
name: 'Manual Trigger',
|
||||||
type: SET_NODE_TYPE,
|
type: MANUAL_TRIGGER_NODE_TYPE,
|
||||||
typeVersion: 1,
|
typeVersion: 1,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
});
|
});
|
||||||
|
@ -68,6 +68,10 @@ async function setupStore() {
|
||||||
|
|
||||||
nodeTypesStore.setNodeTypes([
|
nodeTypesStore.setNodeTypes([
|
||||||
...defaultNodeDescriptions,
|
...defaultNodeDescriptions,
|
||||||
|
mockNodeTypeDescription({
|
||||||
|
name: MANUAL_TRIGGER_NODE_TYPE,
|
||||||
|
outputs: [NodeConnectionType.Main],
|
||||||
|
}),
|
||||||
mockNodeTypeDescription({
|
mockNodeTypeDescription({
|
||||||
name: IF_NODE_TYPE,
|
name: IF_NODE_TYPE,
|
||||||
outputs: [NodeConnectionType.Main, NodeConnectionType.Main],
|
outputs: [NodeConnectionType.Main, NodeConnectionType.Main],
|
||||||
|
@ -128,7 +132,7 @@ describe('RunDataSchema.vue', () => {
|
||||||
connectionType: 'main',
|
connectionType: 'main',
|
||||||
search: '',
|
search: '',
|
||||||
nodes: [
|
nodes: [
|
||||||
{ name: 'Set1', indicies: [], depth: 1 },
|
{ name: 'Manual Trigger', indicies: [], depth: 1 },
|
||||||
{ name: 'Set2', indicies: [], depth: 2 },
|
{ name: 'Set2', indicies: [], depth: 2 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -164,7 +168,7 @@ describe('RunDataSchema.vue', () => {
|
||||||
const { getAllByTestId } = renderComponent();
|
const { getAllByTestId } = renderComponent();
|
||||||
const headers = getAllByTestId('run-data-schema-header');
|
const headers = getAllByTestId('run-data-schema-header');
|
||||||
expect(headers.length).toBe(2);
|
expect(headers.length).toBe(2);
|
||||||
expect(headers[0]).toHaveTextContent('Set1');
|
expect(headers[0]).toHaveTextContent('Manual Trigger');
|
||||||
expect(headers[0]).toHaveTextContent('2 items');
|
expect(headers[0]).toHaveTextContent('2 items');
|
||||||
expect(headers[1]).toHaveTextContent('Set2');
|
expect(headers[1]).toHaveTextContent('Set2');
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,9 @@ type Props = {
|
||||||
expression?: string;
|
expression?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
id: string;
|
id: string;
|
||||||
icon?: string;
|
icon: string;
|
||||||
collapsable?: boolean;
|
collapsable?: boolean;
|
||||||
nodeType?: string;
|
nodeType?: string;
|
||||||
type: 'item';
|
|
||||||
highlight?: boolean;
|
highlight?: boolean;
|
||||||
draggable?: boolean;
|
draggable?: boolean;
|
||||||
collapsed?: boolean;
|
collapsed?: boolean;
|
||||||
|
@ -45,7 +44,7 @@ const emit = defineEmits<{
|
||||||
class="pill"
|
class="pill"
|
||||||
:class="{ 'pill--highlight': highlight }"
|
:class="{ 'pill--highlight': highlight }"
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon v-if="icon" class="type-icon" :icon size="sm" />
|
<FontAwesomeIcon class="type-icon" :icon size="sm" />
|
||||||
<TextWithHighlights class="title" :content="title" :search="props.search" />
|
<TextWithHighlights class="title" :content="title" :search="props.search" />
|
||||||
</div>
|
</div>
|
||||||
<TextWithHighlights class="text" :content="value" :search="props.search" />
|
<TextWithHighlights class="text" :content="value" :search="props.search" />
|
||||||
|
|
|
@ -175,6 +175,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -249,6 +250,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -323,6 +325,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -418,6 +421,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -492,6 +496,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -593,7 +598,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-header"
|
data-test-id="run-data-schema-header"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-c0d66716=""
|
data-v-c0d66716=""
|
||||||
id="Set1"
|
id="Manual Trigger"
|
||||||
type="header"
|
type="header"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -624,7 +629,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="n8n-node-icon icon icon"
|
class="n8n-node-icon icon icon-trigger icon icon-trigger"
|
||||||
data-v-c0d66716=""
|
data-v-c0d66716=""
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -648,10 +653,32 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
class="title"
|
class="title"
|
||||||
data-v-c0d66716=""
|
data-v-c0d66716=""
|
||||||
>
|
>
|
||||||
Set1
|
Manual Trigger
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<font-awesome-icon-stub
|
||||||
|
beat="false"
|
||||||
|
beatfade="false"
|
||||||
|
border="false"
|
||||||
|
bounce="false"
|
||||||
|
class="trigger-icon"
|
||||||
|
data-v-c0d66716=""
|
||||||
|
fade="false"
|
||||||
|
fixedwidth="false"
|
||||||
|
flash="false"
|
||||||
|
flip="false"
|
||||||
|
icon="bolt"
|
||||||
|
inverse="false"
|
||||||
|
listitem="false"
|
||||||
|
pulse="false"
|
||||||
|
shake="false"
|
||||||
|
size="xs"
|
||||||
|
spin="false"
|
||||||
|
spinpulse="false"
|
||||||
|
spinreverse="false"
|
||||||
|
swapopacity="false"
|
||||||
|
symbol="false"
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
class="item-count"
|
class="item-count"
|
||||||
data-test-id="run-data-schema-node-item-count"
|
data-test-id="run-data-schema-node-item-count"
|
||||||
|
@ -668,6 +695,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -706,7 +734,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-depth="1"
|
data-depth="1"
|
||||||
data-name="hello world"
|
data-name="hello world"
|
||||||
data-nest-level="1"
|
data-nest-level="1"
|
||||||
data-node-type="n8n-nodes-base.set"
|
data-node-type="n8n-nodes-base.manualTrigger"
|
||||||
data-path="['hello world']"
|
data-path="['hello world']"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
@ -763,6 +791,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -801,7 +830,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-depth="1"
|
data-depth="1"
|
||||||
data-name="hello world[0]"
|
data-name="hello world[0]"
|
||||||
data-nest-level="2"
|
data-nest-level="2"
|
||||||
data-node-type="n8n-nodes-base.set"
|
data-node-type="n8n-nodes-base.manualTrigger"
|
||||||
data-path="['hello world'][0]"
|
data-path="['hello world'][0]"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
@ -858,6 +887,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -896,7 +926,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-depth="1"
|
data-depth="1"
|
||||||
data-name="test"
|
data-name="test"
|
||||||
data-nest-level="3"
|
data-nest-level="3"
|
||||||
data-node-type="n8n-nodes-base.set"
|
data-node-type="n8n-nodes-base.manualTrigger"
|
||||||
data-path="['hello world'][0].test"
|
data-path="['hello world'][0].test"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
@ -953,6 +983,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -965,7 +996,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-depth="1"
|
data-depth="1"
|
||||||
data-name="more to think about"
|
data-name="more to think about"
|
||||||
data-nest-level="4"
|
data-nest-level="4"
|
||||||
data-node-type="n8n-nodes-base.set"
|
data-node-type="n8n-nodes-base.manualTrigger"
|
||||||
data-path="['hello world'][0].test['more to think about']"
|
data-path="['hello world'][0].test['more to think about']"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
@ -1027,6 +1058,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
@ -1039,7 +1071,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-depth="1"
|
data-depth="1"
|
||||||
data-name="test.how"
|
data-name="test.how"
|
||||||
data-nest-level="3"
|
data-nest-level="3"
|
||||||
data-node-type="n8n-nodes-base.set"
|
data-node-type="n8n-nodes-base.manualTrigger"
|
||||||
data-path="['hello world'][0]['test.how']"
|
data-path="['hello world'][0]['test.how']"
|
||||||
data-target="mappable"
|
data-target="mappable"
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
@ -1169,6 +1201,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
data-test-id="run-data-schema-item"
|
data-test-id="run-data-schema-item"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
data-v-ce2825e7=""
|
data-v-ce2825e7=""
|
||||||
|
type="item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="toggle-container"
|
class="toggle-container"
|
||||||
|
|
|
@ -185,7 +185,7 @@ export type RenderItem = {
|
||||||
expression?: string;
|
expression?: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
id: string;
|
id: string;
|
||||||
icon?: string;
|
icon: string;
|
||||||
collapsable?: boolean;
|
collapsable?: boolean;
|
||||||
nodeType?: INodeUi['type'];
|
nodeType?: INodeUi['type'];
|
||||||
type: 'item';
|
type: 'item';
|
||||||
|
@ -334,6 +334,7 @@ export const useFlattenSchema = () => {
|
||||||
if (isDataEmpty(item.schema)) {
|
if (isDataEmpty(item.schema)) {
|
||||||
acc.push({
|
acc.push({
|
||||||
id: `empty-${index}`,
|
id: `empty-${index}`,
|
||||||
|
icon: '',
|
||||||
value: useI18n().baseText('dataMapping.schemaView.emptyData'),
|
value: useI18n().baseText('dataMapping.schemaView.emptyData'),
|
||||||
type: 'item',
|
type: 'item',
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue