Skip to content

Commit 1f079a6

Browse files
committed
Update tests
1 parent e623523 commit 1f079a6

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/github/copilotRemoteAgent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export namespace SessionIdForPr {
5757

5858
const prefix = 'pull-session-by-index';
5959

60-
export function getId(prNumber: number, sessionIndex: number): vscode.Uri {
60+
export function getResource(prNumber: number, sessionIndex: number): vscode.Uri {
6161
return vscode.Uri.from({
6262
scheme: COPILOT_SWE_AGENT, path: `/${prefix}-${prNumber}-${sessionIndex}`,
6363
});

src/github/pullRequestOverview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
509509

510510
private async openSessionLog(message: IRequestMessage<{ link: SessionLinkInfo }>): Promise<void> {
511511
try {
512-
return vscode.commands.executeCommand('vscode.open', COPILOT_SWE_AGENT, SessionIdForPr.getId(this._item.number, message.args.link.sessionIndex));
512+
return vscode.commands.executeCommand('vscode.open', COPILOT_SWE_AGENT, SessionIdForPr.getResource(this._item.number, message.args.link.sessionIndex));
513513
} catch (e) {
514514
Logger.error(`Open session log view failed: ${formatError(e)}`, PullRequestOverviewPanel.ID);
515515
}

src/test/github/copilotRemoteAgent.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { default as assert } from 'assert';
77
import { SinonSandbox, createSandbox } from 'sinon';
88
import * as vscode from 'vscode';
9-
import { CopilotRemoteAgentManager } from '../../github/copilotRemoteAgent';
9+
import { CopilotRemoteAgentManager, SessionIdForPr } from '../../github/copilotRemoteAgent';
1010
import { MockCommandRegistry } from '../mocks/mockCommandRegistry';
1111
import { MockTelemetry } from '../mocks/mockTelemetry';
1212
import { CredentialStore } from '../../github/credentials';
@@ -21,6 +21,7 @@ import { ReposManagerState } from '../../github/folderRepositoryManager';
2121
import { GitApiImpl } from '../../api/api1';
2222
import { MockPrsTreeModel } from '../mocks/mockPRsTreeModel';
2323
import { PrsTreeModel } from '../../view/prsTreeModel';
24+
import { COPILOT_SWE_AGENT } from '../../common/copilot';
2425

2526
const telemetry = new MockTelemetry();
2627
const protocol = new Protocol('https://github.com/github/test.git');
@@ -271,7 +272,7 @@ describe('CopilotRemoteAgentManager', function () {
271272
it('should return empty session when copilot API is not available', async function () {
272273
const token = new vscode.CancellationTokenSource().token;
273274

274-
const result = await manager.provideChatSessionContent('123', token);
275+
const result = await manager.provideChatSessionContent(SessionIdForPr.getResource(123, 0), token);
275276

276277
assert.strictEqual(Array.isArray(result.history), true);
277278
assert.strictEqual(result.history.length, 0);
@@ -282,7 +283,7 @@ describe('CopilotRemoteAgentManager', function () {
282283
const tokenSource = new vscode.CancellationTokenSource();
283284
tokenSource.cancel();
284285

285-
const result = await manager.provideChatSessionContent('123', tokenSource.token);
286+
const result = await manager.provideChatSessionContent(SessionIdForPr.getResource(123, 0), tokenSource.token);
286287

287288
assert.strictEqual(Array.isArray(result.history), true);
288289
assert.strictEqual(result.history.length, 0);
@@ -291,7 +292,7 @@ describe('CopilotRemoteAgentManager', function () {
291292
it('should return empty session for invalid PR number', async function () {
292293
const token = new vscode.CancellationTokenSource().token;
293294

294-
const result = await manager.provideChatSessionContent('invalid', token);
295+
const result = await manager.provideChatSessionContent(vscode.Uri.from({ scheme: COPILOT_SWE_AGENT, path: '/invalid' }), token);
295296

296297
assert.strictEqual(Array.isArray(result.history), true);
297298
assert.strictEqual(result.history.length, 0);

0 commit comments

Comments
 (0)