@@ -934,10 +934,19 @@ describe('getFlowValidation - Integrationstest', () => {
934934
935935 const result = getFlowValidation ( flow , FUNCTION_SIGNATURES , DATA_TYPES ) ;
936936
937- expect ( result . isValid ) . toBe ( true ) ;
938- result . diagnostics . forEach ( ( error ) => {
939- expect ( error . parameterIndex ) . toBeDefined ( )
940- } )
937+ expect ( result . isValid ) . toBe ( false ) ;
938+ expect ( result . diagnostics ) . toEqual ( expect . arrayContaining ( [
939+ expect . objectContaining ( {
940+ nodeId : "gid://sagittarius/NodeFunction/1" ,
941+ message : 'The function definition "http::response::create" is not reachable.' ,
942+ severity : "error" ,
943+ } ) ,
944+ expect . objectContaining ( {
945+ nodeId : "gid://sagittarius/NodeFunction/4" ,
946+ message : 'The function definition "http::response::create" is not reachable.' ,
947+ severity : "error" ,
948+ } ) ,
949+ ] ) ) ;
941950 } ) ;
942951
943952 it ( '11' , ( ) => {
@@ -1278,4 +1287,43 @@ describe('getFlowValidation - Integrationstest', () => {
12781287 } )
12791288 } ) ;
12801289
1290+ it ( 'fails when a node references an unreachable function definition' , ( ) => {
1291+
1292+ const flow : Flow = {
1293+ startingNodeId : "gid://sagittarius/NodeFunction/1" ,
1294+ nodes : {
1295+ nodes : [
1296+ {
1297+ id : "gid://sagittarius/NodeFunction/1" ,
1298+ functionDefinition : { identifier : "std::number::add" } ,
1299+ parameters : {
1300+ nodes : [
1301+ { value : { __typename : "LiteralValue" , value : 1 } } ,
1302+ { value : { __typename : "LiteralValue" , value : 2 } }
1303+ ]
1304+ } ,
1305+ nextNodeId : "gid://sagittarius/NodeFunction/2"
1306+ } ,
1307+ {
1308+ id : "gid://sagittarius/NodeFunction/2" ,
1309+ functionDefinition : { identifier : "std::imaginary::nonexistent" } ,
1310+ parameters : { nodes : [ ] }
1311+ }
1312+ ]
1313+ }
1314+ } ;
1315+
1316+ const result = getFlowValidation ( flow , FUNCTION_SIGNATURES , DATA_TYPES ) ;
1317+
1318+ expect ( result . isValid ) . toBe ( false ) ;
1319+ expect ( result . diagnostics ) . toEqual ( [
1320+ expect . objectContaining ( {
1321+ nodeId : "gid://sagittarius/NodeFunction/2" ,
1322+ parameterIndex : null ,
1323+ message : 'The function definition "std::imaginary::nonexistent" is not reachable.' ,
1324+ severity : "error" ,
1325+ } )
1326+ ] ) ;
1327+ } ) ;
1328+
12811329} ) ;
0 commit comments