Skip to content

Commit 4c70194

Browse files
authored
Merge pull request #757 from code0-tech/750-expand-spec-coverage-for-flowscreateservice-and-flowsupdateservice
Extend flow specs
2 parents c348547 + 939dfc0 commit 4c70194

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

app/services/namespaces/projects/flows/create_service.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ def create_node_function(node_function_id, input_nodes, t)
132132
next
133133
end
134134

135+
# This will be broken, because we cant reference nodes that arent created yet
136+
# And we will need to put all parameter nodes inside the flowinput.nodes
137+
# So we can reference them here because we will not recursively search for them
135138
referenced_node = NodeFunction.joins(:runtime_function).find_by(
136139
id: parameter.value.reference_value.node_function_id.model_id,
137140
runtime_function_definitions: { runtime_id: namespace_project.primary_runtime.id }

app/services/namespaces/projects/flows/update_service.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ def update_node_parameters(t, current_node, current_node_input, all_nodes)
192192
t
193193
)
194194

195+
# This will be broken, because we cant reference nodes that arent created yet
196+
# And we will need to put all parameter nodes inside the flowinput.nodes
197+
# So we can reference them here because we will not recursively search for them
195198
referenced_node = NodeFunction.joins(:runtime_function).find_by(
196199
id: parameter.value.reference_value.node_function_id.model_id,
197200
runtime_function_definitions: { runtime_id: flow.project.primary_runtime.id }

spec/requests/graphql/mutation/namespace/projects/flows/create_mutation_spec.rb

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
flow: {
6060
name: generate(:flow_name),
6161
type: flow_type.to_global_id.to_s,
62-
startingNodeId: 'gid://sagittarius/NodeFunction/999',
62+
startingNodeId: 'gid://sagittarius/NodeFunction/1000',
6363
settings: {
6464
flowSettingIdentifier: 'key',
6565
value: {
@@ -68,23 +68,46 @@
6868
},
6969
nodes: [
7070
{
71-
id: 'gid://sagittarius/NodeFunction/999',
71+
id: 'gid://sagittarius/NodeFunction/1000',
7272
runtimeFunctionId: runtime_function.to_global_id.to_s,
7373
parameters: [
7474
runtimeParameterDefinitionId: runtime_function.parameters.first.to_global_id.to_s,
7575
value: {
76-
literalValue: 'test_value',
76+
functionValue: {
77+
id: 'gid://sagittarius/NodeFunction/2000',
78+
runtimeFunctionId: runtime_function.to_global_id.to_s,
79+
nextNodeId: nil,
80+
parameters: [
81+
{
82+
runtimeParameterDefinitionId: runtime_function.parameters.first.to_global_id.to_s,
83+
value: {
84+
literalValue: 100,
85+
},
86+
}
87+
],
88+
},
7789
}
7890
],
79-
nextNodeId: 'gid://sagittarius/NodeFunction/991',
91+
nextNodeId: 'gid://sagittarius/NodeFunction/1001',
8092
},
8193
{
82-
id: 'gid://sagittarius/NodeFunction/991',
94+
id: 'gid://sagittarius/NodeFunction/1001',
8395
runtimeFunctionId: runtime_function.to_global_id.to_s,
8496
parameters: [
8597
runtimeParameterDefinitionId: runtime_function.parameters.first.to_global_id.to_s,
8698
value: {
87-
literalValue: 'test_value2',
99+
# https://github.com/code0-tech/sagittarius/issues/756
100+
literalValue: 42,
101+
# referenceValue: {
102+
# depth: 1,
103+
# node: 1,
104+
# scope: [],
105+
# referencePath: [],
106+
# nodeFunctionId: 'gid://sagittarius/NodeFunction/2000',
107+
# dataTypeIdentifier: {
108+
# genericKey: 'K',
109+
# },
110+
# },
88111
}
89112
],
90113
}

0 commit comments

Comments
 (0)