Skip to content

Add comprehensive tests for lm/utils.ts chatCommand function#7666

Closed
Copilot wants to merge 1 commit intojoshspicer/new-chat-sessionfrom
copilot/fix-cfbe38c4-71c4-41ae-90db-b35014c940a0
Closed

Add comprehensive tests for lm/utils.ts chatCommand function#7666
Copilot wants to merge 1 commit intojoshspicer/new-chat-sessionfrom
copilot/fix-cfbe38c4-71c4-41ae-90db-b35014c940a0

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 26, 2025

This PR adds missing test coverage for the chatCommand() function in src/lm/utils.ts. The function determines which chat command to use based on the experimental.useQuickChat configuration setting, but was previously untested.

Changes Made

  • Created src/test/lm/utils.test.ts with comprehensive test coverage
  • Added tests for all code paths:
    • Returns QUICK_CHAT_OPEN when experimental.useQuickChat is true
    • Returns OPEN_CHAT when experimental.useQuickChat is false
    • Returns OPEN_CHAT when using the default value (undefined/false)

Implementation Details

The tests use proper VS Code workspace configuration mocking to simulate different user settings. Each test case:

  1. Mocks vscode.workspace.getConfiguration() to return controlled values
  2. Calls the chatCommand() function
  3. Verifies the correct command constant is returned
  4. Properly cleans up mocks using beforeEach/afterEach hooks

The implementation follows existing project patterns and passes all linting, hygiene, and TypeScript compilation checks.

Why This Matters

Having test coverage for this utility function ensures that:

  • Changes to the chat command selection logic are validated
  • The experimental feature flag behavior is properly tested
  • Regression testing prevents breaking the chat integration functionality

This addresses the gap in test coverage for language model utilities and helps maintain code quality standards across the extension.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/20.19.4/x64/bin/node ./out/src/test/runTests.js --help (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@joshspicer joshspicer closed this Aug 26, 2025
Copilot AI changed the title [WIP] test Add comprehensive tests for lm/utils.ts chatCommand function Aug 26, 2025
Copilot AI requested a review from joshspicer August 26, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants