@@ -112,6 +112,34 @@ describe("transcribe command", () => {
112112 vi . unstubAllEnvs ( ) ;
113113 } ) ;
114114
115+ it ( "keeps quiet Spanish words before the relative speech onset in transcript and captions" , async ( ) => {
116+ const { dir, input } = dummyAudio ( ) ;
117+ dirs . push ( dir ) ;
118+ const words = [
119+ { id : "w0" , text : "Siempre" , start : 0.2 , end : 0.49 } ,
120+ { id : "w1" , text : "que" , start : 0.49 , end : 0.7 } ,
121+ { id : "w2" , text : "los" , start : 0.7 , end : 0.91 } ,
122+ { id : "w3" , text : "nietos" , start : 0.91 , end : 1.33 } ,
123+ { id : "w4" , text : "vecindario" , start : 10.03 , end : 11.02 } ,
124+ ] ;
125+ const htmlPath = join ( dir , "index.html" ) ;
126+ writeFileSync ( htmlPath , "<script>const TRANSCRIPT = [];</script>" ) ;
127+ transcribeMock . mockImplementation ( async ( _input , outputDir ) => {
128+ const result = fakeTranscript ( outputDir , "whisper" ) ;
129+ writeFileSync ( result . transcriptPath , JSON . stringify ( words ) ) ;
130+ return { ...result , wordCount : 5 , durationSeconds : 50 , speechOnsetSeconds : 10 } ;
131+ } ) ;
132+
133+ await runCommand ( transcribeCmd , {
134+ rawArgs : [ input , "--dir" , dir , "--engine" , "whisper" , "--language" , "es" , "--json" ] ,
135+ } ) ;
136+
137+ expect ( JSON . parse ( readFileSync ( join ( dir , "transcript.json" ) , "utf8" ) ) ) . toEqual ( words ) ;
138+ const captions = readFileSync ( htmlPath , "utf8" ) . match ( / c o n s t T R A N S C R I P T = ( [ \s \S ] * ?) ; / ) ! [ 1 ] ! ;
139+ expect ( JSON . parse ( captions ) ) . toEqual ( words ) ;
140+ expect ( lastJson ( ) ) . toMatchObject ( { ok : true , wordCount : 5 , speechOnsetSeconds : 10 } ) ;
141+ } ) ;
142+
115143 it ( "keeps typed progress on stderr and reports resolved metadata in one stdout result" , async ( ) => {
116144 const { dir, input } = dummyAudio ( ) ;
117145 dirs . push ( dir ) ;
0 commit comments