@@ -22,75 +22,118 @@ describe("status_set tool validation", () => {
2222
2323 const emojis = [ "🔍" , "📝" , "✅" , "🚀" , "⏳" ] ;
2424 for ( const emoji of emojis ) {
25- const result = await tool . execute ! ( { emoji, message : "Test" } , mockToolCallOptions ) ;
25+ const result = ( await tool . execute ! ( { emoji, message : "Test" } , mockToolCallOptions ) ) as {
26+ success : boolean ;
27+ emoji : string ;
28+ message : string ;
29+ } ;
2630 expect ( result ) . toEqual ( { success : true , emoji, message : "Test" } ) ;
2731 }
2832 } ) ;
2933
3034 it ( "should reject multiple emojis" , async ( ) => {
3135 const tool = createStatusSetTool ( mockConfig ) ;
3236
33- const result1 = await tool . execute ! ( { emoji : "🔍📝" , message : "Test" } , mockToolCallOptions ) ;
34- expect ( result1 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
37+ const result1 = ( await tool . execute ! (
38+ { emoji : "🔍📝" , message : "Test" } ,
39+ mockToolCallOptions
40+ ) ) as { success : boolean ; error : string } ;
41+ expect ( result1 . success ) . toBe ( false ) ;
42+ expect ( result1 . error ) . toBe ( "emoji must be a single emoji character" ) ;
3543
36- const result2 = await tool . execute ! ( { emoji : "✅✅" , message : "Test" } , mockToolCallOptions ) ;
37- expect ( result2 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
44+ const result2 = ( await tool . execute ! (
45+ { emoji : "✅✅" , message : "Test" } ,
46+ mockToolCallOptions
47+ ) ) as { success : boolean ; error : string } ;
48+ expect ( result2 . success ) . toBe ( false ) ;
49+ expect ( result2 . error ) . toBe ( "emoji must be a single emoji character" ) ;
3850 } ) ;
3951
4052 it ( "should reject text (non-emoji)" , async ( ) => {
4153 const tool = createStatusSetTool ( mockConfig ) ;
4254
43- const result1 = await tool . execute ! ( { emoji : "a" , message : "Test" } , mockToolCallOptions ) ;
44- expect ( result1 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
45-
46- const result2 = await tool . execute ! ( { emoji : "abc" , message : "Test" } , mockToolCallOptions ) ;
47- expect ( result2 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
55+ const result1 = ( await tool . execute ! (
56+ { emoji : "a" , message : "Test" } ,
57+ mockToolCallOptions
58+ ) ) as {
59+ success : boolean ;
60+ error : string ;
61+ } ;
62+ expect ( result1 . success ) . toBe ( false ) ;
63+ expect ( result1 . error ) . toBe ( "emoji must be a single emoji character" ) ;
64+
65+ const result2 = ( await tool . execute ! (
66+ { emoji : "abc" , message : "Test" } ,
67+ mockToolCallOptions
68+ ) ) as { success : boolean ; error : string } ;
69+ expect ( result2 . success ) . toBe ( false ) ;
70+ expect ( result2 . error ) . toBe ( "emoji must be a single emoji character" ) ;
4871
49- const result3 = await tool . execute ! ( { emoji : "!" , message : "Test" } , mockToolCallOptions ) ;
50- expect ( result3 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
72+ const result3 = ( await tool . execute ! (
73+ { emoji : "!" , message : "Test" } ,
74+ mockToolCallOptions
75+ ) ) as {
76+ success : boolean ;
77+ error : string ;
78+ } ;
79+ expect ( result3 . success ) . toBe ( false ) ;
80+ expect ( result3 . error ) . toBe ( "emoji must be a single emoji character" ) ;
5181 } ) ;
5282
5383 it ( "should reject empty emoji" , async ( ) => {
5484 const tool = createStatusSetTool ( mockConfig ) ;
5585
56- const result = await tool . execute ! ( { emoji : "" , message : "Test" } , mockToolCallOptions ) ;
57- expect ( result ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
86+ const result = ( await tool . execute ! ( { emoji : "" , message : "Test" } , mockToolCallOptions ) ) as {
87+ success : boolean ;
88+ error : string ;
89+ } ;
90+ expect ( result . success ) . toBe ( false ) ;
91+ expect ( result . error ) . toBe ( "emoji must be a single emoji character" ) ;
5892 } ) ;
5993
6094 it ( "should reject emoji with text" , async ( ) => {
6195 const tool = createStatusSetTool ( mockConfig ) ;
6296
63- const result1 = await tool . execute ! ( { emoji : "🔍a" , message : "Test" } , mockToolCallOptions ) ;
64- expect ( result1 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
97+ const result1 = ( await tool . execute ! (
98+ { emoji : "🔍a" , message : "Test" } ,
99+ mockToolCallOptions
100+ ) ) as { success : boolean ; error : string } ;
101+ expect ( result1 . success ) . toBe ( false ) ;
102+ expect ( result1 . error ) . toBe ( "emoji must be a single emoji character" ) ;
65103
66- const result2 = await tool . execute ! ( { emoji : "x🔍" , message : "Test" } , mockToolCallOptions ) ;
67- expect ( result2 ) . toEqual ( { success : false , error : "emoji must be a single emoji character" } ) ;
104+ const result2 = ( await tool . execute ! (
105+ { emoji : "x🔍" , message : "Test" } ,
106+ mockToolCallOptions
107+ ) ) as { success : boolean ; error : string } ;
108+ expect ( result2 . success ) . toBe ( false ) ;
109+ expect ( result2 . error ) . toBe ( "emoji must be a single emoji character" ) ;
68110 } ) ;
69111 } ) ;
70112
71113 describe ( "message validation" , ( ) => {
72114 it ( "should accept messages up to 40 characters" , async ( ) => {
73115 const tool = createStatusSetTool ( mockConfig ) ;
74116
75- const result1 = await tool . execute ! (
117+ const result1 = ( await tool . execute ! (
76118 { emoji : "✅" , message : "a" . repeat ( 40 ) } ,
77119 mockToolCallOptions
78- ) ;
120+ ) ) as { success : boolean } ;
79121 expect ( result1 . success ) . toBe ( true ) ;
80122
81- const result2 = await tool . execute ! (
123+ const result2 = ( await tool . execute ! (
82124 { emoji : "✅" , message : "Analyzing code structure" } ,
83125 mockToolCallOptions
84- ) ;
126+ ) ) as { success : boolean } ;
85127 expect ( result2 . success ) . toBe ( true ) ;
86128 } ) ;
87129
88130 it ( "should accept empty message" , async ( ) => {
89131 const tool = createStatusSetTool ( mockConfig ) ;
90132
91- const result = await tool . execute ! ( { emoji : "✅" , message : "" } , mockToolCallOptions ) ;
133+ const result = ( await tool . execute ! ( { emoji : "✅" , message : "" } , mockToolCallOptions ) ) as {
134+ success : boolean ;
135+ } ;
92136 expect ( result . success ) . toBe ( true ) ;
93137 } ) ;
94138 } ) ;
95139} ) ;
96-
0 commit comments