@@ -17,7 +17,7 @@ describe('RovoDevApiClient', () => {
1717 const mockFetch = fetch as jest . MockedFunction < typeof fetch > ;
1818
1919 beforeEach ( ( ) => {
20- client = new RovoDevApiClient ( 'localhost' , 8080 ) ;
20+ client = new RovoDevApiClient ( 'localhost' , 8080 , 'sessionToken' ) ;
2121 mockFetch . mockClear ( ) ;
2222 } ) ;
2323
@@ -27,12 +27,12 @@ describe('RovoDevApiClient', () => {
2727
2828 describe ( 'constructor' , ( ) => {
2929 it ( 'should create instance with correct base URL' , ( ) => {
30- const testClient = new RovoDevApiClient ( 'example.com' , 3000 ) ;
30+ const testClient = new RovoDevApiClient ( 'example.com' , 3000 , 'sessionToken' ) ;
3131 expect ( testClient . baseApiUrl ) . toBe ( 'http://example.com:3000' ) ;
3232 } ) ;
3333
3434 it ( 'should handle IP address and port' , ( ) => {
35- const testClient = new RovoDevApiClient ( '192.168.1.1' , 9000 ) ;
35+ const testClient = new RovoDevApiClient ( '192.168.1.1' , 9000 , 'sessionToken' ) ;
3636 expect ( testClient . baseApiUrl ) . toBe ( 'http://192.168.1.1:9000' ) ;
3737 } ) ;
3838 } ) ;
@@ -60,6 +60,7 @@ describe('RovoDevApiClient', () => {
6060 headers : {
6161 accept : 'text/event-stream' ,
6262 'Content-Type' : 'application/json' ,
63+ Authorization : 'Bearer sessionToken' ,
6364 } ,
6465 body : undefined ,
6566 } ) ;
@@ -83,6 +84,7 @@ describe('RovoDevApiClient', () => {
8384 headers : {
8485 accept : 'text/event-stream' ,
8586 'Content-Type' : 'application/json' ,
87+ Authorization : 'Bearer sessionToken' ,
8688 } ,
8789 body,
8890 } ) ;
@@ -136,6 +138,7 @@ describe('RovoDevApiClient', () => {
136138 headers : {
137139 accept : 'text/event-stream' ,
138140 'Content-Type' : 'application/json' ,
141+ Authorization : 'Bearer sessionToken' ,
139142 } ,
140143 body : undefined ,
141144 } ) ;
@@ -187,6 +190,7 @@ describe('RovoDevApiClient', () => {
187190 method : 'POST' ,
188191 headers : {
189192 accept : 'text/event-stream' ,
193+ Authorization : 'Bearer sessionToken' ,
190194 'Content-Type' : 'application/json' ,
191195 } ,
192196 body : JSON . stringify ( { message, context : [ ] } ) ,
@@ -201,6 +205,7 @@ describe('RovoDevApiClient', () => {
201205 headers : {
202206 accept : 'text/event-stream' ,
203207 'Content-Type' : 'application/json' ,
208+ Authorization : 'Bearer sessionToken' ,
204209 } ,
205210 } ,
206211 ) ;
@@ -222,6 +227,7 @@ describe('RovoDevApiClient', () => {
222227 headers : {
223228 accept : 'text/event-stream' ,
224229 'Content-Type' : 'application/json' ,
230+ Authorization : 'Bearer sessionToken' ,
225231 } ,
226232 body : JSON . stringify ( { message, context : [ ] } ) ,
227233 } ) ;
@@ -235,6 +241,7 @@ describe('RovoDevApiClient', () => {
235241 headers : {
236242 accept : 'text/event-stream' ,
237243 'Content-Type' : 'application/json' ,
244+ Authorization : 'Bearer sessionToken' ,
238245 } ,
239246 } ,
240247 ) ;
@@ -260,6 +267,7 @@ describe('RovoDevApiClient', () => {
260267 headers : {
261268 accept : 'text/event-stream' ,
262269 'Content-Type' : 'application/json' ,
270+ Authorization : 'Bearer sessionToken' ,
263271 } ,
264272 body : JSON . stringify ( { message, enable_deep_plan : true , context : [ ] } ) ,
265273 } ) ;
@@ -273,6 +281,7 @@ describe('RovoDevApiClient', () => {
273281 headers : {
274282 accept : 'text/event-stream' ,
275283 'Content-Type' : 'application/json' ,
284+ Authorization : 'Bearer sessionToken' ,
276285 } ,
277286 } ,
278287 ) ;
@@ -293,6 +302,7 @@ describe('RovoDevApiClient', () => {
293302 headers : {
294303 accept : 'text/event-stream' ,
295304 'Content-Type' : 'application/json' ,
305+ Authorization : 'Bearer sessionToken' ,
296306 } ,
297307 body : JSON . stringify ( { message : '' , context : [ ] } ) ,
298308 } ) ;
@@ -306,6 +316,7 @@ describe('RovoDevApiClient', () => {
306316 headers : {
307317 accept : 'text/event-stream' ,
308318 'Content-Type' : 'application/json' ,
319+ Authorization : 'Bearer sessionToken' ,
309320 } ,
310321 } ,
311322 ) ;
@@ -327,6 +338,7 @@ describe('RovoDevApiClient', () => {
327338 headers : {
328339 accept : 'text/event-stream' ,
329340 'Content-Type' : 'application/json' ,
341+ Authorization : 'Bearer sessionToken' ,
330342 } ,
331343 body : JSON . stringify ( { message, context : [ ] } ) ,
332344 } ) ;
@@ -340,6 +352,7 @@ describe('RovoDevApiClient', () => {
340352 headers : {
341353 accept : 'text/event-stream' ,
342354 'Content-Type' : 'application/json' ,
355+ Authorization : 'Bearer sessionToken' ,
343356 } ,
344357 } ,
345358 ) ;
@@ -362,6 +375,7 @@ describe('RovoDevApiClient', () => {
362375 headers : {
363376 accept : 'text/event-stream' ,
364377 'Content-Type' : 'application/json' ,
378+ Authorization : 'Bearer sessionToken' ,
365379 } ,
366380 body : undefined ,
367381 } ) ;
@@ -401,6 +415,7 @@ describe('RovoDevApiClient', () => {
401415 headers : {
402416 accept : 'text/event-stream' ,
403417 'Content-Type' : 'application/json' ,
418+ Authorization : 'Bearer sessionToken' ,
404419 } ,
405420 body : undefined ,
406421 } ,
@@ -427,6 +442,7 @@ describe('RovoDevApiClient', () => {
427442 headers : {
428443 accept : 'text/event-stream' ,
429444 'Content-Type' : 'application/json' ,
445+ Authorization : 'Bearer sessionToken' ,
430446 } ,
431447 body : undefined ,
432448 } ,
@@ -466,6 +482,7 @@ describe('RovoDevApiClient', () => {
466482 headers : {
467483 accept : 'text/event-stream' ,
468484 'Content-Type' : 'application/json' ,
485+ Authorization : 'Bearer sessionToken' ,
469486 } ,
470487 body : undefined ,
471488 } ) ;
@@ -520,6 +537,7 @@ describe('RovoDevApiClient', () => {
520537 headers : {
521538 accept : 'text/event-stream' ,
522539 'Content-Type' : 'application/json' ,
540+ Authorization : 'Bearer sessionToken' ,
523541 } ,
524542 body : undefined ,
525543 } ) ;
@@ -610,6 +628,7 @@ describe('RovoDevApiClient', () => {
610628 headers : {
611629 accept : 'text/event-stream' ,
612630 'Content-Type' : 'application/json' ,
631+ Authorization : 'Bearer sessionToken' ,
613632 } ,
614633 body : JSON . stringify ( { servers : [ ] , accept_all : 'true' } ) ,
615634 } ) ;
@@ -630,6 +649,7 @@ describe('RovoDevApiClient', () => {
630649 headers : {
631650 accept : 'text/event-stream' ,
632651 'Content-Type' : 'application/json' ,
652+ Authorization : 'Bearer sessionToken' ,
633653 } ,
634654 body : JSON . stringify ( {
635655 servers : [ { server_name : 'server1' , decision : 'accept' } ] ,
@@ -653,6 +673,7 @@ describe('RovoDevApiClient', () => {
653673 headers : {
654674 accept : 'text/event-stream' ,
655675 'Content-Type' : 'application/json' ,
676+ Authorization : 'Bearer sessionToken' ,
656677 } ,
657678 body : JSON . stringify ( { servers : [ { server_name : 'server2' , decision : 'deny' } ] , accept_all : 'false' } ) ,
658679 } ) ;
@@ -689,6 +710,7 @@ describe('RovoDevApiClient', () => {
689710 headers : {
690711 accept : 'text/event-stream' ,
691712 'Content-Type' : 'application/json' ,
713+ Authorization : 'Bearer sessionToken' ,
692714 } ,
693715 body : undefined ,
694716 } ) ;
@@ -734,6 +756,7 @@ describe('RovoDevApiClient', () => {
734756 headers : {
735757 accept : 'text/event-stream' ,
736758 'Content-Type' : 'application/json' ,
759+ Authorization : 'Bearer sessionToken' ,
737760 } ,
738761 body : JSON . stringify ( {
739762 decisions : [
@@ -765,6 +788,7 @@ describe('RovoDevApiClient', () => {
765788 headers : {
766789 accept : 'text/event-stream' ,
767790 'Content-Type' : 'application/json' ,
791+ Authorization : 'Bearer sessionToken' ,
768792 } ,
769793 body : JSON . stringify ( {
770794 decisions : [
@@ -796,6 +820,7 @@ describe('RovoDevApiClient', () => {
796820 headers : {
797821 accept : 'text/event-stream' ,
798822 'Content-Type' : 'application/json' ,
823+ Authorization : 'Bearer sessionToken' ,
799824 } ,
800825 body : JSON . stringify ( {
801826 decisions : [
@@ -829,6 +854,7 @@ describe('RovoDevApiClient', () => {
829854 headers : {
830855 accept : 'text/event-stream' ,
831856 'Content-Type' : 'application/json' ,
857+ Authorization : 'Bearer sessionToken' ,
832858 } ,
833859 body : JSON . stringify ( {
834860 decisions : [
@@ -866,6 +892,7 @@ describe('RovoDevApiClient', () => {
866892 headers : {
867893 accept : 'text/event-stream' ,
868894 'Content-Type' : 'application/json' ,
895+ Authorization : 'Bearer sessionToken' ,
869896 } ,
870897 body : JSON . stringify ( {
871898 decisions : [ ] ,
@@ -893,6 +920,7 @@ describe('RovoDevApiClient', () => {
893920 headers : {
894921 accept : 'text/event-stream' ,
895922 'Content-Type' : 'application/json' ,
923+ Authorization : 'Bearer sessionToken' ,
896924 } ,
897925 body : JSON . stringify ( {
898926 decisions : [
0 commit comments