Skip to content

Commit 07a2ff2

Browse files
author
nicosammito
committed
feat: enhance nodeValidation tests for improved validation accuracy and consistency
1 parent b5e4622 commit 07a2ff2

1 file changed

Lines changed: 73 additions & 2 deletions

File tree

test/nodeValidation.test.ts

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {describe, expect, it} from 'vitest';
22
import {getNodeValidation} from '../src/validation/getNodeValidation';
3-
import {FUNCTION_SIGNATURES, DATA_TYPES} from "./data";
3+
import {DATA_TYPES, FUNCTION_SIGNATURES} from "./data";
44

55
describe('getNodeValidation', () => {
66
it('1', () => {
@@ -356,7 +356,7 @@ describe('getNodeValidation', () => {
356356
nodes: [{
357357
value: {
358358
__typename: "LiteralValue",
359-
value: [1,2,3]
359+
value: [1, 2, 3]
360360
}
361361
}, {
362362
value: {
@@ -591,5 +591,76 @@ describe('getNodeValidation', () => {
591591
expect(result.diagnostics.filter(e => e.severity === 'error').length).toBe(0);
592592
})
593593

594+
it('12', () => {
595+
const result = getNodeValidation({
596+
nodes: {
597+
nodes: [
598+
{
599+
id: "gid://sagittarius/NodeFunction/1",
600+
functionDefinition: {
601+
identifier: "std::number::add" as any
602+
},
603+
parameters: {
604+
nodes: [{
605+
value: {
606+
__typename: "LiteralValue",
607+
value: 1
608+
}
609+
}, {
610+
value: {
611+
__typename: "LiteralValue",
612+
value: 1
613+
}
614+
}]
615+
}
616+
},
617+
{
618+
id: "gid://sagittarius/NodeFunction/2",
619+
functionDefinition: {
620+
identifier: "std::number::add" as any
621+
},
622+
parameters: {
623+
nodes: [{
624+
value: {
625+
__typename: "NodeFunctionIdWrapper",
626+
id: "gid://sagittarius/NodeFunction/1"
627+
}
628+
}, {
629+
value: {
630+
__typename: "LiteralValue",
631+
value: 1
632+
}
633+
}]
634+
}
635+
}
636+
]
637+
}
638+
}, {
639+
id: "gid://sagittarius/NodeFunction/2",
640+
functionDefinition: {
641+
identifier: "std::number::add" as any
642+
},
643+
parameters: {
644+
nodes: [{
645+
value: {
646+
__typename: "NodeFunctionIdWrapper",
647+
id: "gid://sagittarius/NodeFunction/1"
648+
}
649+
}, {
650+
value: {
651+
__typename: "LiteralValue",
652+
value: 1
653+
}
654+
}]
655+
}
656+
}, FUNCTION_SIGNATURES, DATA_TYPES);
657+
658+
console.log(result)
659+
660+
expect(result.isValid).toBe(true);
661+
expect(result.returnType).toBeDefined();
662+
expect(result.diagnostics.filter(e => e.severity === 'error').length).toBe(0);
663+
})
664+
594665
});
595666

0 commit comments

Comments
 (0)