-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use 'env' instead of 'envVars' in Claude desktop config
- Updates MCPServer interface to use 'env' key - Adds unit tests to verify config structure Fixes #48 Co-Authored-By: Michael Latman <[email protected]>
- Loading branch information
1 parent
07b9365
commit 2f0a711
Showing
5 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { jest, describe, it, expect, beforeEach } from '@jest/globals'; | ||
import { ConfigManager } from '../config-manager'; | ||
import { Package } from '../../types/package'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
jest.mock('fs'); | ||
jest.mock('path'); | ||
|
||
describe('ConfigManager', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
describe('installPackage', () => { | ||
it('should create config with "env" key for environment variables', async () => { | ||
const mockPackage: Package = { | ||
name: 'test-package', | ||
description: 'Test package for config manager', | ||
runtime: 'node', | ||
vendor: 'test-vendor', | ||
sourceUrl: 'https://github.com/test/test-package', | ||
homepage: 'https://test-package.com', | ||
license: 'MIT' | ||
}; | ||
|
||
const mockEnvVars = { | ||
TEST_KEY: 'test-value' | ||
}; | ||
|
||
const writeFileSpy = jest.spyOn(fs, 'writeFileSync'); | ||
|
||
await ConfigManager.installPackage(mockPackage, mockEnvVars); | ||
|
||
expect(writeFileSpy).toHaveBeenCalled(); | ||
const writtenConfig = JSON.parse(writeFileSpy.mock.calls[0][1] as string); | ||
expect(writtenConfig.mcpServers['test-package'].env).toBeDefined(); | ||
expect(writtenConfig.mcpServers['test-package'].envVars).toBeUndefined(); | ||
expect(writtenConfig.mcpServers['test-package'].env).toEqual(mockEnvVars); | ||
}); | ||
}); | ||
}); |
This file contains 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