@@ -20,8 +20,8 @@ const EXAMPLE_NODE_DEF: ComfyNodeDef = {
2020}
2121
2222describe ( 'validateNodeDef' , ( ) => {
23- it ( 'Should accept a valid node definition' , ( ) => {
24- expect ( ( ) => validateComfyNodeDef ( EXAMPLE_NODE_DEF ) ) . not . toThrow ( )
23+ it ( 'Should accept a valid node definition' , async ( ) => {
24+ expect ( await validateComfyNodeDef ( EXAMPLE_NODE_DEF ) ) . not . toBeNull ( )
2525 } )
2626
2727 describe . each ( [
@@ -35,14 +35,16 @@ describe('validateNodeDef', () => {
3535 ] ) (
3636 'validateComfyNodeDef with various input spec formats' ,
3737 ( inputSpec , expected ) => {
38- it ( `should accept input spec format: ${ JSON . stringify ( inputSpec ) } ` , ( ) => {
38+ it ( `should accept input spec format: ${ JSON . stringify ( inputSpec ) } ` , async ( ) => {
3939 expect (
40- validateComfyNodeDef ( {
41- ...EXAMPLE_NODE_DEF ,
42- input : {
43- required : inputSpec
44- }
45- } ) . input . required . ckpt_name
40+ (
41+ await validateComfyNodeDef ( {
42+ ...EXAMPLE_NODE_DEF ,
43+ input : {
44+ required : inputSpec
45+ }
46+ } )
47+ ) . input . required . ckpt_name
4648 ) . toEqual ( expected )
4749 } )
4850 }
@@ -57,15 +59,15 @@ describe('validateNodeDef', () => {
5759 ] ) (
5860 'validateComfyNodeDef rejects with various input spec formats' ,
5961 ( inputSpec ) => {
60- it ( `should accept input spec format: ${ JSON . stringify ( inputSpec ) } ` , ( ) => {
61- expect ( ( ) =>
62- validateComfyNodeDef ( {
62+ it ( `should accept input spec format: ${ JSON . stringify ( inputSpec ) } ` , async ( ) => {
63+ expect (
64+ await validateComfyNodeDef ( {
6365 ...EXAMPLE_NODE_DEF ,
6466 input : {
6567 required : inputSpec
6668 }
6769 } )
68- ) . toThrow ( )
70+ ) . toBeNull ( )
6971 } )
7072 }
7173 )
@@ -76,8 +78,9 @@ describe('validateNodeDef', () => {
7678 fs . readFileSync ( path . resolve ( './tests-ui/data/object_info.json' ) )
7779 )
7880 )
79- nodeDefs . forEach ( ( nodeDef ) => {
80- expect ( ( ) => validateComfyNodeDef ( nodeDef ) ) . not . toThrow ( )
81- } )
81+
82+ for ( const nodeDef of nodeDefs ) {
83+ expect ( await validateComfyNodeDef ( nodeDef ) ) . not . toBeNull ( )
84+ }
8285 } )
8386} )
0 commit comments