Skip to content

Commit 04c9b3d

Browse files
author
nicosammito
committed
feat: refactor getReferenceSuggestions tests for improved readability and consistency
1 parent b2c9511 commit 04c9b3d

1 file changed

Lines changed: 30 additions & 31 deletions

File tree

test/getReferenceSuggestions.test.ts

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { describe, expect, it } from 'vitest';
2-
import { getReferenceSuggestions } from '../src/getReferenceSuggestions';
3-
import { Flow } from "@code0-tech/sagittarius-graphql-types";
4-
import { FUNCTION_SIGNATURES, DATA_TYPES } from "../src/data";
5-
import {json} from "node:stream/consumers";
1+
import {describe, expect, it} from 'vitest';
2+
import {getReferenceSuggestions} from '../src/getReferenceSuggestions';
3+
import {Flow} from "@code0-tech/sagittarius-graphql-types";
4+
import {DATA_TYPES, FUNCTION_SIGNATURES} from "../src/data";
65

76
const node1Id = "gid://sagittarius/NodeFunction/1" as any;
87
const node2Id = "gid://sagittarius/NodeFunction/2" as any;
@@ -12,13 +11,13 @@ const childId = "gid://sagittarius/NodeFunction/11" as any;
1211
describe('getReferenceSuggestions', () => {
1312
it('sollte Flow Input vorschlagen, wenn der Typ passt', () => {
1413
const flow: Flow = {
15-
inputType: { identifier: "NUMBER" },
14+
inputType: {identifier: "NUMBER"},
1615
nodes: {
1716
nodes: [
1817
{
1918
id: node1Id,
20-
functionDefinition: { identifier: "std::math::add" },
21-
parameters: { nodes: [] }
19+
functionDefinition: {identifier: "std::math::add"},
20+
parameters: {nodes: []}
2221
}
2322
]
2423
}
@@ -35,19 +34,19 @@ describe('getReferenceSuggestions', () => {
3534
nodes: [
3635
{
3736
id: node1Id,
38-
functionDefinition: { identifier: "std::math::add" },
37+
functionDefinition: {identifier: "std::math::add"},
3938
parameters: {
4039
nodes: [
41-
{ value: { __typename: "LiteralValue", value: 1 } },
42-
{ value: { __typename: "LiteralValue", value: 2 } }
40+
{value: {__typename: "LiteralValue", value: 1}},
41+
{value: {__typename: "LiteralValue", value: 2}}
4342
]
4443
},
4544
nextNodeId: node2Id
4645
},
4746
{
4847
id: node2Id,
49-
functionDefinition: { identifier: "std::math::add" },
50-
parameters: { nodes: [] }
48+
functionDefinition: {identifier: "std::math::add"},
49+
parameters: {nodes: []}
5150
}
5251
]
5352
}
@@ -64,14 +63,14 @@ describe('getReferenceSuggestions', () => {
6463
nodes: [
6564
{
6665
id: node1Id,
67-
functionDefinition: { identifier: "std::math::add" },
68-
parameters: { nodes: [] }
66+
functionDefinition: {identifier: "std::math::add"},
67+
parameters: {nodes: []}
6968
// node1 ist nicht mit node2 verbunden
7069
},
7170
{
7271
id: node2Id,
73-
functionDefinition: { identifier: "std::math::add" },
74-
parameters: { nodes: [] }
72+
functionDefinition: {identifier: "std::math::add"},
73+
parameters: {nodes: []}
7574
}
7675
]
7776
}
@@ -88,18 +87,18 @@ describe('getReferenceSuggestions', () => {
8887
nodes: [
8988
{
9089
id: parentId,
91-
functionDefinition: { identifier: "std::control::for_each" },
90+
functionDefinition: {identifier: "std::control::for_each"},
9291
parameters: {
9392
nodes: [
94-
{ value: { __typename: "LiteralValue", value: [1, 2, 3] } },
95-
{ value: { __typename: "NodeFunctionIdWrapper", id: childId } }
93+
{value: {__typename: "LiteralValue", value: [1, 2, 3]}},
94+
{value: {__typename: "NodeFunctionIdWrapper", id: childId}}
9695
]
9796
}
9897
},
9998
{
10099
id: childId,
101-
functionDefinition: { identifier: "std::math::add" },
102-
parameters: { nodes: [] }
100+
functionDefinition: {identifier: "std::math::add"},
101+
parameters: {nodes: []}
103102
}
104103
]
105104
}
@@ -116,24 +115,24 @@ describe('getReferenceSuggestions', () => {
116115
nodes: [
117116
{
118117
id: node1Id,
119-
functionDefinition: { identifier: "std::list::at" }, // Rückgabetyp R
118+
functionDefinition: {identifier: "std::list::at"}, // Rückgabetyp R
120119
parameters: {
121120
nodes: [
122121
{
123122
value: {
124123
__typename: "LiteralValue",
125-
value: [{ user: { name: "Nico", age: 30 } }]
124+
value: [{user: {name: "Nico", age: 30}}]
126125
}
127126
},
128-
{ value: { __typename: "LiteralValue", value: 0 } }
127+
{value: {__typename: "LiteralValue", value: 0}}
129128
]
130129
},
131130
nextNodeId: node2Id
132131
},
133132
{
134133
id: node2Id,
135-
functionDefinition: { identifier: "std::math::add" },
136-
parameters: { nodes: [] }
134+
functionDefinition: {identifier: "std::math::add"},
135+
parameters: {nodes: []}
137136
}
138137
]
139138
}
@@ -161,14 +160,14 @@ describe('getReferenceSuggestions', () => {
161160
nodes: [
162161
{
163162
id: node1Id,
164-
functionDefinition: { identifier: "std::math::add" },
165-
parameters: { nodes: [] },
163+
functionDefinition: {identifier: "std::math::add"},
164+
parameters: {nodes: []},
166165
nextNodeId: node2Id
167166
},
168167
{
169168
id: node2Id,
170-
functionDefinition: { identifier: "std::math::add" },
171-
parameters: { nodes: [] }
169+
functionDefinition: {identifier: "std::math::add"},
170+
parameters: {nodes: []}
172171
}
173172
]
174173
}

0 commit comments

Comments
 (0)