@@ -428,7 +428,7 @@ describe('message truncation utilities', () => {
428428 it ( 'keeps only the last message with truncation when it does not fit the limit' , ( ) => {
429429 const messages = [ { content : `1 ${ humongous } ` } , { content : `2 ${ humongous } ` } , { content : `3 ${ humongous } ` } ] ;
430430 const result = truncateGenAiMessages ( messages ) ;
431- const truncLen = 20_000 - 2 - JSON . stringify ( { content : '' } ) . length - 1 ;
431+ const truncLen = 20_000 - 2 - JSON . stringify ( { content : '' } ) . length ;
432432 expect ( result ) . toStrictEqual ( [ { content : `3 ${ humongous } ` . substring ( 0 , truncLen ) } ] ) ;
433433 } ) ;
434434
@@ -450,7 +450,7 @@ describe('message truncation utilities', () => {
450450 it ( 'truncates if the message content string will not fit' , ( ) => {
451451 const messages = [ { content : `2 ${ humongous } ` } ] ;
452452 const result = truncateGenAiMessages ( messages ) ;
453- const truncLen = 20_000 - 2 - JSON . stringify ( { content : '' } ) . length - 1 ;
453+ const truncLen = 20_000 - 2 - JSON . stringify ( { content : '' } ) . length ;
454454 expect ( result ) . toStrictEqual ( [ { content : `2 ${ humongous } ` . substring ( 0 , truncLen ) } ] ) ;
455455 } ) ;
456456
@@ -491,8 +491,7 @@ describe('message truncation utilities', () => {
491491 2 -
492492 JSON . stringify ( {
493493 parts : [ '' , { some_other_field : 'no text here' , text : '' } ] ,
494- } ) . length -
495- 1 ;
494+ } ) . length ;
496495
497496 expect ( result ) . toStrictEqual ( [
498497 {
@@ -513,8 +512,7 @@ describe('message truncation utilities', () => {
513512 2 -
514513 JSON . stringify ( {
515514 parts : [ { text : '' } ] ,
516- } ) . length -
517- 1 ;
515+ } ) . length ;
518516 expect ( result ) . toStrictEqual ( [
519517 {
520518 parts : [
0 commit comments