@@ -743,8 +743,8 @@ describe('ContractAnalyzer', () => {
743743 expect ( result . queries ) . toEqual ( [
744744 {
745745 name : 'mode' ,
746- params : [ { name : 'm' , schema : { anyOf : [ { type : 'string' } ] } } ] ,
747- returnSchema : { anyOf : [ { type : 'string' } ] } ,
746+ params : [ { name : 'm' , schema : { type : 'string' , enum : [ 'on' , 'off' ] } } ] ,
747+ returnSchema : { type : 'string' , enum : [ 'on' , 'off' ] } ,
748748 } ,
749749 ] ) ;
750750 expect ( result . mutations ) . toEqual ( [ ] ) ;
@@ -1933,13 +1933,13 @@ describe('ContractAnalyzer', () => {
19331933 expect ( result . mutations ) . toEqual ( [
19341934 {
19351935 name : 'handleList' ,
1936- params : [ { name : 'list' , schema : { $ref : 'StringList' } } ] ,
1936+ params : [ { name : 'list' , schema : { type : 'array' , items : { type : 'string' } } } ] ,
19371937 returnSchema : { } ,
19381938 } ,
19391939 {
19401940 name : 'updateNumbers' ,
1941- params : [ { name : 'nums' , schema : { $ref : 'NumberArray' } } ] ,
1942- returnSchema : { $ref : 'NumberArray' } ,
1941+ params : [ { name : 'nums' , schema : { type : 'array' , items : { type : 'number' } } } ] ,
1942+ returnSchema : { type : 'array' , items : { type : 'number' } } ,
19431943 } ,
19441944 ] ) ;
19451945 } ) ;
@@ -2184,7 +2184,7 @@ describe('ContractAnalyzer', () => {
21842184 params : [
21852185 {
21862186 name : 'mode' ,
2187- schema : { anyOf : [ { type : 'string' } ] } ,
2187+ schema : { type : 'string' , enum : [ 'read' , 'write' , 'admin' ] } ,
21882188 } ,
21892189 ] ,
21902190 returnSchema : { } ,
@@ -2576,7 +2576,7 @@ describe('ContractAnalyzer', () => {
25762576 ] ) ;
25772577 } ) ;
25782578
2579- it ( 'should handle type aliases as interface references ' , ( ) => {
2579+ it ( 'should handle type aliases with proper schema expansion ' , ( ) => {
25802580 const sourceFiles = {
25812581 'src/types.ts' : `
25822582 export type Status = 'pending' | 'completed' | 'failed';
@@ -2599,7 +2599,7 @@ describe('ContractAnalyzer', () => {
25992599 }
26002600
26012601 setUserRole(role: UserRole): void {
2602- // set role logic
2602+ this.state.users.push({ role });
26032603 }
26042604
26052605 processTask(task: TaskData): TaskData {
@@ -2615,10 +2615,17 @@ describe('ContractAnalyzer', () => {
26152615 {
26162616 name : 'getStatus' ,
26172617 params : [ ] ,
2618- returnSchema : { $ref : 'Status' } ,
2618+ returnSchema : { type : 'string' , enum : [ 'pending' , 'completed' , 'failed' ] } ,
26192619 } ,
26202620 ] ) ;
26212621 expect ( result . mutations ) . toEqual ( [
2622+ {
2623+ name : 'setUserRole' ,
2624+ params : [
2625+ { name : 'role' , schema : { type : 'string' , enum : [ 'admin' , 'user' , 'guest' ] } } ,
2626+ ] ,
2627+ returnSchema : { } ,
2628+ } ,
26222629 {
26232630 name : 'processTask' ,
26242631 params : [
@@ -2629,7 +2636,7 @@ describe('ContractAnalyzer', () => {
26292636 properties : {
26302637 id : { type : 'string' } ,
26312638 title : { type : 'string' } ,
2632- status : { $ref : 'Status' } ,
2639+ status : { type : 'string' , enum : [ 'pending' , 'completed' , 'failed' ] } ,
26332640 } ,
26342641 required : [ 'id' , 'title' , 'status' ] ,
26352642 } ,
@@ -2640,7 +2647,7 @@ describe('ContractAnalyzer', () => {
26402647 properties : {
26412648 id : { type : 'string' } ,
26422649 title : { type : 'string' } ,
2643- status : { $ref : 'Status' } ,
2650+ status : { type : 'string' , enum : [ 'pending' , 'completed' , 'failed' ] } ,
26442651 } ,
26452652 required : [ 'id' , 'title' , 'status' ] ,
26462653 } ,
0 commit comments