Skip to content

Commit ead285b

Browse files
committed
Fix getIncludes call with E2E test.
1 parent 0aaae1f commit ead285b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Extension/test/scenarios/SingleRootProject/tests/copilotProviders.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ describe('copilotProviders Tests', () => {
2626
let vscodeExtension: vscode.Extension<unknown>;
2727
let telemetryStub: sinon.SinonStub;
2828

29-
const includedFiles = process.platform === 'win32' ?
29+
const includedFiles: string[] = process.platform === 'win32' ?
3030
['c:\\system\\include\\vector', 'c:\\system\\include\\string', 'C:\\src\\my_project\\foo.h'] :
3131
['/system/include/vector', '/system/include/string', '/home/src/my_project/foo.h'];
32-
const rootUri = vscode.Uri.file(process.platform === 'win32' ? 'C:\\src\\my_project' : '/home/src/my_project');
33-
const expectedInclude = process.platform === 'win32' ? 'file:///c%3A/src/my_project/foo.h' : 'file:///home/src/my_project/foo.h';
32+
const rootUri: vscode.Uri = vscode.Uri.file(process.platform === 'win32' ? 'C:\\src\\my_project' : '/home/src/my_project');
33+
const expectedInclude: string = process.platform === 'win32' ? 'file:///c%3A/src/my_project/foo.h' : 'file:///home/src/my_project/foo.h';
34+
const sourceFileUri: vscode.Uri = vscode.Uri.file(process.platform === 'win32' ? 'file:///c%3A/src/my_project/foo.cpp' : 'file:///home/src/my_project/foo.cpp');
35+
const maxDepth: number = 10;
3436

3537
beforeEach(() => {
3638
proxyquire.noPreserveCache(); // Tells proxyquire to not fetch the module from cache
@@ -71,7 +73,7 @@ describe('copilotProviders Tests', () => {
7173

7274
activeClientStub = sinon.createStubInstance(DefaultClient);
7375
getActiveClientStub = sinon.stub(extension, 'getActiveClient').returns(activeClientStub);
74-
activeClientStub.getIncludes.resolves({ includedFiles: [] });
76+
activeClientStub.getIncludes.resolves({ includedFiles: [] })(sourceFileUri, maxDepth);
7577
telemetryStub = sinon.stub(telemetry, 'logCopilotEvent').returns();
7678
});
7779

@@ -83,7 +85,7 @@ describe('copilotProviders Tests', () => {
8385
{ vscodeExtension?: vscode.Extension<unknown>; getIncludeFiles?: GetIncludesResult; projectContext?: ProjectContext; rootUri?: vscode.Uri; flags?: Record<string, unknown> } =
8486
{ vscodeExtension: undefined, getIncludeFiles: undefined, projectContext: undefined, rootUri: undefined, flags: {} }
8587
) => {
86-
activeClientStub.getIncludes.resolves(getIncludeFiles);
88+
activeClientStub.getIncludes.resolves(getIncludeFiles)(sourceFileUri, maxDepth);
8789
sinon.stub(lmTool, 'getProjectContext').resolves(projectContext);
8890
sinon.stub(activeClientStub, 'RootUri').get(() => rootUri);
8991
mockCopilotApi.registerRelatedFilesProvider.callsFake((_providerId: { extensionId: string; languageId: string }, callback: (uri: vscode.Uri, context: { flags: Record<string, unknown> }, cancellationToken: vscode.CancellationToken) => Promise<{ entries: vscode.Uri[]; traits?: CopilotTrait[] }>) => {

0 commit comments

Comments
 (0)