mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
trigger node test
This commit is contained in:
parent
c4bd0f0b0b
commit
ccca4c4e90
|
@ -9,7 +9,7 @@ import {
|
|||
defaultNodeDescriptions,
|
||||
mockNodeTypeDescription,
|
||||
} 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 { mock } from 'vitest-mock-extended';
|
||||
import type { IWorkflowDb } from '@/Interface';
|
||||
|
@ -17,8 +17,8 @@ import { NodeConnectionType, type IDataObject } from 'n8n-workflow';
|
|||
import * as nodeHelpers from '@/composables/useNodeHelpers';
|
||||
|
||||
const mockNode1 = createTestNode({
|
||||
name: 'Set1',
|
||||
type: SET_NODE_TYPE,
|
||||
name: 'Manual Trigger',
|
||||
type: MANUAL_TRIGGER_NODE_TYPE,
|
||||
typeVersion: 1,
|
||||
disabled: false,
|
||||
});
|
||||
|
@ -68,6 +68,10 @@ async function setupStore() {
|
|||
|
||||
nodeTypesStore.setNodeTypes([
|
||||
...defaultNodeDescriptions,
|
||||
mockNodeTypeDescription({
|
||||
name: MANUAL_TRIGGER_NODE_TYPE,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
}),
|
||||
mockNodeTypeDescription({
|
||||
name: IF_NODE_TYPE,
|
||||
outputs: [NodeConnectionType.Main, NodeConnectionType.Main],
|
||||
|
@ -128,7 +132,7 @@ describe('RunDataSchema.vue', () => {
|
|||
connectionType: 'main',
|
||||
search: '',
|
||||
nodes: [
|
||||
{ name: 'Set1', indicies: [], depth: 1 },
|
||||
{ name: 'Manual Trigger', indicies: [], depth: 1 },
|
||||
{ name: 'Set2', indicies: [], depth: 2 },
|
||||
],
|
||||
},
|
||||
|
@ -164,7 +168,7 @@ describe('RunDataSchema.vue', () => {
|
|||
const { getAllByTestId } = renderComponent();
|
||||
const headers = getAllByTestId('run-data-schema-header');
|
||||
expect(headers.length).toBe(2);
|
||||
expect(headers[0]).toHaveTextContent('Set1');
|
||||
expect(headers[0]).toHaveTextContent('Manual Trigger');
|
||||
expect(headers[0]).toHaveTextContent('2 items');
|
||||
expect(headers[1]).toHaveTextContent('Set2');
|
||||
|
||||
|
|
|
@ -10,10 +10,9 @@ type Props = {
|
|||
expression?: string;
|
||||
value?: string;
|
||||
id: string;
|
||||
icon?: string;
|
||||
icon: string;
|
||||
collapsable?: boolean;
|
||||
nodeType?: string;
|
||||
type: 'item';
|
||||
highlight?: boolean;
|
||||
draggable?: boolean;
|
||||
collapsed?: boolean;
|
||||
|
@ -45,7 +44,7 @@ const emit = defineEmits<{
|
|||
class="pill"
|
||||
: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" />
|
||||
</div>
|
||||
<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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -249,6 +250,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
|||
data-test-id="run-data-schema-item"
|
||||
data-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -323,6 +325,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
|||
data-test-id="run-data-schema-item"
|
||||
data-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -418,6 +421,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
|||
data-test-id="run-data-schema-item"
|
||||
data-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -492,6 +496,7 @@ exports[`RunDataSchema.vue > renders schema in output pane 1`] = `
|
|||
data-test-id="run-data-schema-item"
|
||||
data-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
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-v-46dade00=""
|
||||
data-v-c0d66716=""
|
||||
id="Set1"
|
||||
id="Manual Trigger"
|
||||
type="header"
|
||||
>
|
||||
<div
|
||||
|
@ -624,7 +629,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
/>
|
||||
</div>
|
||||
<div
|
||||
class="n8n-node-icon icon icon"
|
||||
class="n8n-node-icon icon icon-trigger icon icon-trigger"
|
||||
data-v-c0d66716=""
|
||||
>
|
||||
<div
|
||||
|
@ -648,10 +653,32 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
class="title"
|
||||
data-v-c0d66716=""
|
||||
>
|
||||
Set1
|
||||
Manual Trigger
|
||||
<!--v-if-->
|
||||
</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
|
||||
class="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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -706,7 +734,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
data-depth="1"
|
||||
data-name="hello world"
|
||||
data-nest-level="1"
|
||||
data-node-type="n8n-nodes-base.set"
|
||||
data-node-type="n8n-nodes-base.manualTrigger"
|
||||
data-path="['hello world']"
|
||||
data-target="mappable"
|
||||
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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -801,7 +830,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
data-depth="1"
|
||||
data-name="hello world[0]"
|
||||
data-nest-level="2"
|
||||
data-node-type="n8n-nodes-base.set"
|
||||
data-node-type="n8n-nodes-base.manualTrigger"
|
||||
data-path="['hello world'][0]"
|
||||
data-target="mappable"
|
||||
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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -896,7 +926,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
data-depth="1"
|
||||
data-name="test"
|
||||
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-target="mappable"
|
||||
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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -965,7 +996,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
data-depth="1"
|
||||
data-name="more to think about"
|
||||
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-target="mappable"
|
||||
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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
@ -1039,7 +1071,7 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
|||
data-depth="1"
|
||||
data-name="test.how"
|
||||
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-target="mappable"
|
||||
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-v-46dade00=""
|
||||
data-v-ce2825e7=""
|
||||
type="item"
|
||||
>
|
||||
<div
|
||||
class="toggle-container"
|
||||
|
|
|
@ -185,7 +185,7 @@ export type RenderItem = {
|
|||
expression?: string;
|
||||
value?: string;
|
||||
id: string;
|
||||
icon?: string;
|
||||
icon: string;
|
||||
collapsable?: boolean;
|
||||
nodeType?: INodeUi['type'];
|
||||
type: 'item';
|
||||
|
@ -334,6 +334,7 @@ export const useFlattenSchema = () => {
|
|||
if (isDataEmpty(item.schema)) {
|
||||
acc.push({
|
||||
id: `empty-${index}`,
|
||||
icon: '',
|
||||
value: useI18n().baseText('dataMapping.schemaView.emptyData'),
|
||||
type: 'item',
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue