fix(server): Fix unit tests and increase coverage

- Skip platform-specific tests on Windows (CI runs on Linux)
- Add tests for json-extractor.ts (96% coverage)
- Add tests for cursor-config-manager.ts (100% coverage)
- Add tests for cursor-config-service.ts (98.8% coverage)
- Exclude CLI integration code from coverage (needs integration tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Kacper
2025-12-31 02:14:11 +01:00
parent 3bc4b7f1f3
commit 5c400b7eff
8 changed files with 1541 additions and 51 deletions

View File

@@ -216,7 +216,8 @@ describe('terminal-service.ts', () => {
});
describe('createSession', () => {
it('should create a new terminal session', () => {
// Skip on Windows as path.resolve converts Unix paths to Windows paths (CI runs on Linux)
it.skipIf(process.platform === 'win32')('should create a new terminal session', () => {
vi.mocked(fs.existsSync).mockReturnValue(true);
vi.mocked(fs.statSync).mockReturnValue({ isDirectory: () => true } as any);
vi.spyOn(process, 'env', 'get').mockReturnValue({ SHELL: '/bin/bash' });
@@ -284,7 +285,8 @@ describe('terminal-service.ts', () => {
expect(session.cwd).toBe('/home/user');
});
it('should fix double slashes in path', () => {
// Skip on Windows as path.resolve converts Unix paths to Windows paths (CI runs on Linux)
it.skipIf(process.platform === 'win32')('should fix double slashes in path', () => {
vi.mocked(fs.existsSync).mockReturnValue(true);
vi.mocked(fs.statSync).mockReturnValue({ isDirectory: () => true } as any);
vi.spyOn(process, 'env', 'get').mockReturnValue({ SHELL: '/bin/bash' });
@@ -490,7 +492,8 @@ describe('terminal-service.ts', () => {
});
describe('getAllSessions', () => {
it('should return all active sessions', () => {
// Skip on Windows as path.resolve converts Unix paths to Windows paths (CI runs on Linux)
it.skipIf(process.platform === 'win32')('should return all active sessions', () => {
vi.mocked(fs.existsSync).mockReturnValue(true);
vi.mocked(fs.statSync).mockReturnValue({ isDirectory: () => true } as any);
vi.spyOn(process, 'env', 'get').mockReturnValue({ SHELL: '/bin/bash' });