Merged
Conversation
We have two `MockChatService` classes. This makes updating the interface slow since you have to update both locations. The two also behave slightly differently
jrieken
approved these changes
Mar 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates duplicated MockChatService implementations used in chat-related tests, aiming to reduce maintenance burden and keep test behavior consistent with the IChatService interface.
Changes:
- Updated the shared
MockChatServiceimplementation to cover the behavior previously embedded in a browser test. - Removed the inline
MockChatServicefromlocalAgentSessionsController.test.tsand switched the test to import the shared mock. - Adjusted test calls to match the shared mock’s API (e.g.,
addSession(mockModel)).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts | Refactors the shared mock service implementation to support more test scenarios and centralize behavior. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/localAgentSessionsController.test.ts | Removes the local mock and consumes the shared mock service instead. |
Comments suppressed due to low confidence (3)
src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts:136
IChatService.addCompleteRequestis defined with five parameters (sessionResource/message/variableData/attempt/response). The mock currently declaresaddCompleteRequest()with no parameters, which removes compile-time pressure to keep the mock aligned with the interface. Please update the method signature to matchIChatService.addCompleteRequest(unused params can be_-prefixed).
addCompleteRequest(): void { }
src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts:152
notifyQuestionCarouselAnswershould use the service’sIChatQuestionAnswers | undefinedtype for itsanswersparameter (perIChatService) rather thanRecord<string, unknown>. Using the real type keeps this mock in sync with interface changes and prevents accidentally accepting/producing shapes that production code can’t handle.
notifyQuestionCarouselAnswer(_requestId: string, _resolveId: string, _answers: Record<string, unknown> | undefined): void { }
src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts:156
IChatService.transferChatSessionandIChatService.setChatSessionTitleboth take(sessionResource: URI, ...)parameters. In this mock they are currently declared with no parameters, which again weakens compile-time alignment with the interface and can hide breaking signature changes. Please update both method signatures to matchIChatService(parameters can be unused).
async transferChatSession(): Promise<void> { }
setChatSessionTitle(): void { }
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have two
MockChatServiceclasses. This makes updating the interface slow since you have to update both locations. The two also behave slightly differently. After a quick code review I think they can be consolidated