@@ -4,7 +4,7 @@ import { handleStreamingProgress } from './upgrade';
44/**
55 * Helper to create a mock readable stream with progress updates
66 */
7- function createMockStream ( progressValues : string [ ] ) : ReadableStream < Uint8Array > {
7+ function createStubStream ( progressValues : string [ ] ) : ReadableStream < Uint8Array > {
88 const encoder = new TextEncoder ( ) ;
99 let index = 0 ;
1010
@@ -24,8 +24,8 @@ function createMockStream(progressValues: string[]): ReadableStream<Uint8Array>
2424/**
2525 * Helper to create a mock Response with a readable stream
2626 */
27- function createMockResponse ( progressValues : string [ ] ) : Response {
28- const stream = createMockStream ( progressValues ) ;
27+ function createStubResponse ( progressValues : string [ ] ) : Response {
28+ const stream = createStubStream ( progressValues ) ;
2929 return new Response ( stream ) ;
3030}
3131
@@ -50,7 +50,7 @@ describe('handleStreamingProgress', () => {
5050 } ) ;
5151
5252 it ( 'should update progress bar with streaming values' , async ( ) => {
53- const response = createMockResponse ( [ '10%' , '25%' , '50%' , '75%' , '90%' ] ) ;
53+ const response = createStubResponse ( [ '10%' , '25%' , '50%' , '75%' , '90%' ] ) ;
5454
5555 await handleStreamingProgress ( response , progressBarId ) ;
5656
@@ -63,7 +63,7 @@ describe('handleStreamingProgress', () => {
6363 } ) ;
6464
6565 it ( 'should handle empty stream and complete with 100%' , async ( ) => {
66- const response = createMockResponse ( [ ] ) ;
66+ const response = createStubResponse ( [ ] ) ;
6767
6868 await handleStreamingProgress ( response , progressBarId ) ;
6969
@@ -96,7 +96,7 @@ describe('handleStreamingProgress', () => {
9696 } ) ;
9797
9898 it ( 'should handle missing progress bar element' , async ( ) => {
99- const response = createMockResponse ( [ '50%' ] ) ;
99+ const response = createStubResponse ( [ '50%' ] ) ;
100100 const consoleErrorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
101101
102102 await handleStreamingProgress ( response , 'non-existent-id' ) ;
@@ -119,7 +119,7 @@ describe('handleStreamingProgress', () => {
119119
120120 it ( 'should update progress bar incrementally' , async ( ) => {
121121 const progressValues = [ '25%' , '50%' , '75%' ] ;
122- const response = createMockResponse ( progressValues ) ;
122+ const response = createStubResponse ( progressValues ) ;
123123
124124 // We need to intercept the updates as they happen
125125 const updates : string [ ] = [ ] ;
@@ -170,7 +170,7 @@ describe('handleStreamingProgress', () => {
170170 } ) ;
171171
172172 it ( 'should remove animation classes when complete' , async ( ) => {
173- const response = createMockResponse ( [ '50%' ] ) ;
173+ const response = createStubResponse ( [ '50%' ] ) ;
174174
175175 // Verify initial state has animation classes
176176 expect ( progressBar . classList . contains ( 'progress-bar-animated' ) ) . toBe ( true ) ;
@@ -187,7 +187,7 @@ describe('handleStreamingProgress', () => {
187187 it ( 'should handle rapid progress updates' , async ( ) => {
188188 // Create many rapid updates
189189 const progressValues = Array . from ( { length : 20 } , ( _ , i ) => `${ ( i + 1 ) * 5 } %` ) ;
190- const response = createMockResponse ( progressValues ) ;
190+ const response = createStubResponse ( progressValues ) ;
191191
192192 await handleStreamingProgress ( response , progressBarId ) ;
193193
@@ -255,7 +255,7 @@ describe('Progress bar integration scenarios', () => {
255255 </div>
256256 ` ;
257257
258- const response = createMockResponse ( [ '33%' , '66%' , '99%' ] ) ;
258+ const response = createStubResponse ( [ '33%' , '66%' , '99%' ] ) ;
259259 await handleStreamingProgress ( response , 'integration-test-bar' ) ;
260260
261261 const progressBar = document . getElementById ( 'integration-test-bar' ) as HTMLElement ;
0 commit comments