@@ -14,6 +14,7 @@ import * as vscode from 'vscode'
1414import fs from 'fs'
1515import sinon from 'sinon'
1616import { createAmazonQUri , getFileDiffUris , getOriginalFileUri , openDeletedDiff , openDiff } from '../../../amazonq'
17+ import { FileSystem } from '../../../shared/fs/fs'
1718
1819describe ( 'diff' , ( ) => {
1920 const filePath = path . join ( '/' , 'foo' , 'fi' )
@@ -57,15 +58,15 @@ describe('diff', () => {
5758 const name = 'foo'
5859
5960 it ( 'file exists locally' , async ( ) => {
60- sandbox . stub ( fs , 'existsSync ' ) . returns ( true )
61+ sandbox . stub ( FileSystem . prototype , 'exists ' ) . resolves ( true )
6162 await openDeletedDiff ( filePath , name , tabId )
6263
6364 const expectedPath = vscode . Uri . file ( filePath )
6465 assert . ok ( executeCommandSpy . calledWith ( 'vscode.open' , expectedPath , { } , `${ name } (Deleted)` ) )
6566 } )
6667
6768 it ( 'file does not exists locally' , async ( ) => {
68- sandbox . stub ( fs , 'existsSync ' ) . returns ( false )
69+ sandbox . stub ( FileSystem . prototype , 'exists ' ) . resolves ( false )
6970 await openDeletedDiff ( filePath , name , tabId )
7071
7172 const expectedPath = createAmazonQUri ( 'empty' , tabId )
@@ -74,9 +75,9 @@ describe('diff', () => {
7475 } )
7576
7677 describe ( 'getOriginalFileUri' , ( ) => {
77- it ( 'file exists locally' , ( ) => {
78+ it ( 'file exists locally' , async ( ) => {
7879 sandbox . stub ( fs , 'existsSync' ) . returns ( true )
79- assert . deepStrictEqual ( getOriginalFileUri ( filePath , tabId ) . fsPath , filePath )
80+ assert . deepStrictEqual ( ( await getOriginalFileUri ( filePath , tabId ) ) . fsPath , filePath )
8081 } )
8182
8283 it ( 'file does not exists locally' , ( ) => {
@@ -87,10 +88,10 @@ describe('diff', () => {
8788 } )
8889
8990 describe ( 'getFileDiffUris' , ( ) => {
90- it ( 'file exists locally' , ( ) => {
91+ it ( 'file exists locally' , async ( ) => {
9192 sandbox . stub ( fs , 'existsSync' ) . returns ( true )
9293
93- const { left, right } = getFileDiffUris ( filePath , rightPath , tabId )
94+ const { left, right } = await getFileDiffUris ( filePath , rightPath , tabId )
9495
9596 const leftExpected = vscode . Uri . file ( filePath )
9697 assert . deepStrictEqual ( left , leftExpected )
@@ -99,9 +100,9 @@ describe('diff', () => {
99100 assert . deepStrictEqual ( right , rightExpected )
100101 } )
101102
102- it ( 'file does not exists locally' , ( ) => {
103+ it ( 'file does not exists locally' , async ( ) => {
103104 sandbox . stub ( fs , 'existsSync' ) . returns ( false )
104- const { left, right } = getFileDiffUris ( filePath , rightPath , tabId )
105+ const { left, right } = await getFileDiffUris ( filePath , rightPath , tabId )
105106
106107 const leftExpected = getOriginalFileUri ( filePath , tabId )
107108 assert . deepStrictEqual ( left , leftExpected )
0 commit comments