@@ -23,6 +23,7 @@ import { waitUntil } from '../../shared'
2323import { FollowUpTypes } from '../../amazonq/commons/types'
2424import { FileSystem } from '../../shared/fs/fs'
2525import { ReadmeBuilder } from './mockContent'
26+ import * as path from 'path'
2627
2728describe ( 'Controller - Doc Generation' , ( ) => {
2829 const tabID = '123'
@@ -39,11 +40,11 @@ describe('Controller - Doc Generation', () => {
3940
4041 const getFilePaths = ( controllerSetup : ControllerSetup ) : NewFileInfo [ ] => [
4142 {
42- zipFilePath : 'README.md' ,
43- relativePath : 'README.md' ,
43+ zipFilePath : path . normalize ( 'README.md' ) ,
44+ relativePath : path . normalize ( 'README.md' ) ,
4445 fileContent : generatedReadme ,
4546 rejected : false ,
46- virtualMemoryUri : generateVirtualMemoryUri ( uploadID , 'README.md' , docScheme ) ,
47+ virtualMemoryUri : generateVirtualMemoryUri ( uploadID , path . normalize ( 'README.md' ) , docScheme ) ,
4748 workspaceFolder : controllerSetup . workspaceFolder ,
4849 changeApplied : false ,
4950 } ,
@@ -138,7 +139,7 @@ describe('Controller - Doc Generation', () => {
138139 codewhispererChat : 'connected' ,
139140 amazonQ : 'connected' ,
140141 } )
141- sinon . stub ( FileSystem . prototype , 'exists' ) . resolves ( true )
142+ sinon . stub ( FileSystem . prototype , 'exists' ) . callsFake ( async ( ) => true )
142143 getSessionStub = sinon . stub ( controllerSetup . sessionStorage , 'getSession' ) . resolves ( session )
143144 modifiedReadme = ReadmeBuilder . createReadmeWithRepoStructure ( )
144145 sinon
@@ -228,6 +229,7 @@ describe('Controller - Doc Generation', () => {
228229 } )
229230 } )
230231 it ( 'should emit generation telemetry for README update' , async ( ) => {
232+ await updateFilePaths ( session , modifiedReadme , uploadID , docScheme , controllerSetup . workspaceFolder )
231233 await performAction ( 'update' , getSessionStub )
232234
233235 const expectedEvent = createExpectedEvent ( {
@@ -269,6 +271,7 @@ describe('Controller - Doc Generation', () => {
269271 } )
270272
271273 it ( 'should emit acceptance telemetry for README update' , async ( ) => {
274+ await updateFilePaths ( session , modifiedReadme , uploadID , docScheme , controllerSetup . workspaceFolder )
272275 await performAction ( 'update' , getSessionStub )
273276 await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) )
274277
@@ -289,6 +292,7 @@ describe('Controller - Doc Generation', () => {
289292 } )
290293
291294 it ( 'should emit generation telemetry for README edit' , async ( ) => {
295+ await updateFilePaths ( session , modifiedReadme , uploadID , docScheme , controllerSetup . workspaceFolder )
292296 await performAction ( 'edit' , getSessionStub , 'add repository structure section' )
293297
294298 const expectedEvent = createExpectedEvent ( {
@@ -305,6 +309,7 @@ describe('Controller - Doc Generation', () => {
305309 } )
306310 } )
307311 it ( 'should emit acceptance telemetry for README edit' , async ( ) => {
312+ await updateFilePaths ( session , modifiedReadme , uploadID , docScheme , controllerSetup . workspaceFolder )
308313 await performAction ( 'edit' , getSessionStub , 'add repository structure section' )
309314 await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) )
310315
0 commit comments