Skip to content

Commit 0eba055

Browse files
committed
💄
1 parent e96d72f commit 0eba055

2 files changed

Lines changed: 11 additions & 38 deletions

File tree

‎src/issues/issueTodoProvider.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class IssueTodoProvider implements vscode.CodeActionProvider {
1515

1616
constructor(
1717
context: vscode.ExtensionContext,
18-
private copilotRemoteAgentManager?: CopilotRemoteAgentManager
18+
private copilotRemoteAgentManager: CopilotRemoteAgentManager
1919
) {
2020
context.subscriptions.push(
2121
vscode.workspace.onDidChangeConfiguration(() => {

‎src/test/issues/issueTodoProvider.test.ts‎

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,37 @@ import * as vscode from 'vscode';
88
import { IssueTodoProvider } from '../../issues/issueTodoProvider';
99

1010
describe('IssueTodoProvider', function () {
11-
it('should provide Create GitHub Issue action for TODO comments', async function () {
12-
const mockContext = {
13-
subscriptions: []
14-
} as vscode.ExtensionContext;
15-
16-
const provider = new IssueTodoProvider(mockContext);
17-
18-
// Create a mock document with TODO comment
19-
const text = 'function test() {\n // TODO: Fix this\n return 42;\n}';
20-
const document = {
21-
lineAt: (line: number) => ({ text: line === 1 ? ' // TODO: Fix this' : 'function test() {' }),
22-
lineCount: 4
23-
} as vscode.TextDocument;
24-
25-
const range = new vscode.Range(1, 0, 1, 20);
26-
const context = {
27-
only: vscode.CodeActionKind.QuickFix
28-
} as vscode.CodeActionContext;
29-
30-
const actions = await provider.provideCodeActions(document, range, context, new vscode.CancellationTokenSource().token);
31-
32-
assert.strictEqual(actions.length, 1);
33-
assert.strictEqual(actions[0].title, 'Create GitHub Issue');
34-
assert.strictEqual(actions[0].command?.command, 'issue.createIssueFromSelection');
35-
});
36-
3711
it('should provide both actions when CopilotRemoteAgentManager is available', async function () {
3812
const mockContext = {
3913
subscriptions: []
40-
} as vscode.ExtensionContext;
41-
14+
} as any as vscode.ExtensionContext;
15+
4216
const mockCopilotManager = {} as any; // Mock CopilotRemoteAgentManager
43-
17+
4418
const provider = new IssueTodoProvider(mockContext, mockCopilotManager);
45-
19+
4620
// Create a mock document with TODO comment
47-
const text = 'function test() {\n // TODO: Fix this\n return 42;\n}';
4821
const document = {
4922
lineAt: (line: number) => ({ text: line === 1 ? ' // TODO: Fix this' : 'function test() {' }),
5023
lineCount: 4
5124
} as vscode.TextDocument;
52-
25+
5326
const range = new vscode.Range(1, 0, 1, 20);
5427
const context = {
5528
only: vscode.CodeActionKind.QuickFix
5629
} as vscode.CodeActionContext;
57-
30+
5831
const actions = await provider.provideCodeActions(document, range, context, new vscode.CancellationTokenSource().token);
59-
32+
6033
assert.strictEqual(actions.length, 2);
61-
34+
6235
// Find the actions
6336
const createIssueAction = actions.find(a => a.title === 'Create GitHub Issue');
6437
const startAgentAction = actions.find(a => a.title === 'Start Coding Agent Session');
65-
38+
6639
assert.ok(createIssueAction, 'Should have Create GitHub Issue action');
6740
assert.ok(startAgentAction, 'Should have Start Coding Agent Session action');
68-
41+
6942
assert.strictEqual(createIssueAction?.command?.command, 'issue.createIssueFromSelection');
7043
assert.strictEqual(startAgentAction?.command?.command, 'issue.startCodingAgentFromTodo');
7144
});

0 commit comments

Comments
 (0)