Skip to content

Commit a17b37d

Browse files
Copilotalexr00
andauthored
Remove file-scoped comment test that only tests mocks
Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/2bb682a1-a239-4791-a328-bfb6a7d341dd Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 791e8c8 commit a17b37d

File tree

2 files changed

+10
-129
lines changed

2 files changed

+10
-129
lines changed

src/@types/vscode.proposed.chatSessionsProvider.d.ts

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ declare module 'vscode' {
343343
/**
344344
* Statistics about the chat session.
345345
*/
346-
changes?: readonly ChatSessionChangedFile[] | readonly ChatSessionChangedFile2[];
346+
changes?: readonly ChatSessionChangedFile[];
347347

348348
/**
349349
* Arbitrary metadata for the chat session. Can be anything, but must be JSON-stringifyable.
@@ -353,34 +353,7 @@ declare module 'vscode' {
353353
metadata?: { readonly [key: string]: any };
354354
}
355355

356-
/**
357-
* @deprecated Use `ChatSessionChangedFile2` instead
358-
*/
359356
export class ChatSessionChangedFile {
360-
/**
361-
* URI of the file.
362-
*/
363-
modifiedUri: Uri;
364-
365-
/**
366-
* File opened when the user takes the 'compare' action.
367-
*/
368-
originalUri?: Uri;
369-
370-
/**
371-
* Number of insertions made during the session.
372-
*/
373-
insertions: number;
374-
375-
/**
376-
* Number of deletions made during the session.
377-
*/
378-
deletions: number;
379-
380-
constructor(modifiedUri: Uri, insertions: number, deletions: number, originalUri?: Uri);
381-
}
382-
383-
export class ChatSessionChangedFile2 {
384357
/**
385358
* URI of the file.
386359
*/
@@ -728,9 +701,18 @@ declare module 'vscode' {
728701
export interface ChatSessionInputState {
729702
/**
730703
* Fired when the input state is changed by the user.
704+
*
705+
* Move to controller?
731706
*/
732707
readonly onDidChange: Event<void>;
733708

709+
/**
710+
* The resource associated with this chat session.
711+
*
712+
* This is `undefined` for chat sessions that have not yet started.
713+
*/
714+
readonly sessionResource: Uri | undefined;
715+
734716
/**
735717
* The groups of options to show in the UI for user input.
736718
*

src/test/view/reviewCommentController.test.ts

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -339,106 +339,5 @@ describe('ReviewCommentController', function () {
339339
assert.strictEqual(Object.keys(workspaceFileChangeCommentThreads)[0], fileName);
340340
assert.strictEqual(workspaceFileChangeCommentThreads[fileName].length, 1);
341341
});
342-
343-
it('creates a file-scoped comment on an empty thread', async function () {
344-
const fileName = 'data/products.json';
345-
const uri = vscode.Uri.parse(`${repository.rootUri.toString()}/${fileName}`);
346-
await activePullRequest.initializeReviewThreadCache();
347-
const localFileChanges = [createLocalFileChange(uri, fileName, repository.rootUri)];
348-
const reviewModel = new ReviewModel();
349-
reviewModel.localFileChanges = localFileChanges;
350-
const reviewCommentController = new TestReviewCommentController(
351-
reviewManager,
352-
manager,
353-
repository,
354-
reviewModel,
355-
gitApiImpl,
356-
telemetry
357-
);
358-
const thread = createGHPRCommentThread('review-1.2', uri);
359-
thread.range = undefined as any;
360-
361-
sinon.stub(activePullRequest, 'validateDraftMode').returns(Promise.resolve(false));
362-
sinon.stub(activePullRequest, 'getReviewThreads').returns(Promise.resolve([]));
363-
sinon.stub(activePullRequest, 'getPendingReviewId').returns(Promise.resolve(undefined));
364-
365-
sinon.stub(manager, 'getCurrentUser').returns(Promise.resolve({
366-
login: 'rmacfarlane',
367-
url: 'https://github.com/rmacfarlane',
368-
id: '123',
369-
accountType: AccountType.User
370-
}));
371-
372-
sinon.stub(vscode.workspace, 'getWorkspaceFolder').returns({
373-
uri: repository.rootUri,
374-
name: '',
375-
index: 0,
376-
});
377-
378-
sinon.stub(vscode.workspace, 'asRelativePath').callsFake((pathOrUri: string | vscode.Uri): string => {
379-
const path = pathOrUri.toString();
380-
return path.substring('/root/'.length);
381-
});
382-
383-
sinon.stub(repository, 'diffWith').returns(Promise.resolve(''));
384-
385-
await reviewCommentController.initialize();
386-
387-
githubRepo.queryProvider.expectGraphQLMutation(
388-
{
389-
mutation: schema.AddReviewThread,
390-
variables: {
391-
input: {
392-
path: fileName,
393-
body: 'file comment',
394-
pullRequestId: activePullRequest.graphNodeId,
395-
pullRequestReviewId: undefined,
396-
startLine: undefined,
397-
line: undefined,
398-
side: 'RIGHT',
399-
subjectType: 'FILE'
400-
}
401-
}
402-
},
403-
{
404-
data: {
405-
addPullRequestReviewThread: {
406-
thread: {
407-
id: 2,
408-
isResolved: false,
409-
viewCanResolve: true,
410-
path: fileName,
411-
line: null,
412-
startLine: null,
413-
originalStartLine: null,
414-
originalLine: null,
415-
diffSide: 'RIGHT',
416-
isOutdated: false,
417-
subjectType: 'FILE',
418-
comments: {
419-
nodes: [
420-
{
421-
databaseId: 2,
422-
id: 2,
423-
body: 'file comment',
424-
commit: {},
425-
diffHunk: '',
426-
reactionGroups: [],
427-
author: {}
428-
}
429-
]
430-
}
431-
}
432-
}
433-
}
434-
}
435-
)
436-
437-
const newReviewThreadPromise = asPromise(activePullRequest.onDidChangeReviewThreads);
438-
await reviewCommentController.createOrReplyComment(thread, 'file comment', false);
439-
await newReviewThreadPromise;
440-
assert.strictEqual(thread.comments.length, 1);
441-
assert.strictEqual(thread.comments[0].parent, thread);
442-
});
443342
});
444343
});

0 commit comments

Comments
 (0)