|
1 | 1 | import {describe, expect, it} from 'vitest'; |
2 | 2 | import {getNodeValidation} from '../src/validation/getNodeValidation'; |
3 | | -import {FUNCTION_SIGNATURES, DATA_TYPES} from "./data"; |
| 3 | +import {DATA_TYPES, FUNCTION_SIGNATURES} from "./data"; |
4 | 4 |
|
5 | 5 | describe('getNodeValidation', () => { |
6 | 6 | it('1', () => { |
@@ -356,7 +356,7 @@ describe('getNodeValidation', () => { |
356 | 356 | nodes: [{ |
357 | 357 | value: { |
358 | 358 | __typename: "LiteralValue", |
359 | | - value: [1,2,3] |
| 359 | + value: [1, 2, 3] |
360 | 360 | } |
361 | 361 | }, { |
362 | 362 | value: { |
@@ -591,5 +591,76 @@ describe('getNodeValidation', () => { |
591 | 591 | expect(result.diagnostics.filter(e => e.severity === 'error').length).toBe(0); |
592 | 592 | }) |
593 | 593 |
|
| 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 | + |
594 | 665 | }); |
595 | 666 |
|
0 commit comments