From 18e52c2012b8e45d281175374059ebc66ce3c328 Mon Sep 17 00:00:00 2001 From: Joe Danziger Date: Wed, 4 Jun 2025 20:30:27 -0400 Subject: [PATCH] add missing integration tests --- .../claude-init-functionality.test.js | 55 +++++++++++++++++ .../profiles/cline-init-functionality.test.js | 58 ++++++++++++++++++ .../profiles/codex-init-functionality.test.js | 59 +++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 tests/integration/profiles/claude-init-functionality.test.js create mode 100644 tests/integration/profiles/cline-init-functionality.test.js create mode 100644 tests/integration/profiles/codex-init-functionality.test.js diff --git a/tests/integration/profiles/claude-init-functionality.test.js b/tests/integration/profiles/claude-init-functionality.test.js new file mode 100644 index 00000000..cfc00b20 --- /dev/null +++ b/tests/integration/profiles/claude-init-functionality.test.js @@ -0,0 +1,55 @@ +import fs from 'fs'; +import path from 'path'; + +describe('Claude Profile Initialization Functionality', () => { + let claudeProfileContent; + + beforeAll(() => { + const claudeJsPath = path.join( + process.cwd(), + 'scripts', + 'profiles', + 'claude.js' + ); + claudeProfileContent = fs.readFileSync(claudeJsPath, 'utf8'); + }); + + test('claude.js is a simple profile with correct configuration', () => { + expect(claudeProfileContent).toContain("profileName: 'claude'"); + expect(claudeProfileContent).toContain("displayName: 'Claude Code'"); + expect(claudeProfileContent).toContain("profileDir: '.'"); + expect(claudeProfileContent).toContain("rulesDir: '.'"); + }); + + test('claude.js has no MCP configuration', () => { + expect(claudeProfileContent).toContain('mcpConfig: false'); + expect(claudeProfileContent).toContain('mcpConfigName: null'); + expect(claudeProfileContent).toContain('mcpConfigPath: null'); + }); + + test('claude.js has empty file map (simple profile)', () => { + expect(claudeProfileContent).toContain('fileMap: {}'); + expect(claudeProfileContent).toContain('conversionConfig: {}'); + expect(claudeProfileContent).toContain('globalReplacements: []'); + }); + + test('claude.js has lifecycle functions for file management', () => { + expect(claudeProfileContent).toContain('function onAddRulesProfile'); + expect(claudeProfileContent).toContain('function onRemoveRulesProfile'); + expect(claudeProfileContent).toContain( + 'function onPostConvertRulesProfile' + ); + }); + + test('claude.js copies AGENTS.md to CLAUDE.md', () => { + expect(claudeProfileContent).toContain("'AGENTS.md'"); + expect(claudeProfileContent).toContain("'CLAUDE.md'"); + expect(claudeProfileContent).toContain('copyFileSync'); + }); + + test('claude.js has proper error handling', () => { + expect(claudeProfileContent).toContain('try {'); + expect(claudeProfileContent).toContain('} catch (err) {'); + expect(claudeProfileContent).toContain("log('error'"); + }); +}); diff --git a/tests/integration/profiles/cline-init-functionality.test.js b/tests/integration/profiles/cline-init-functionality.test.js new file mode 100644 index 00000000..eef00d78 --- /dev/null +++ b/tests/integration/profiles/cline-init-functionality.test.js @@ -0,0 +1,58 @@ +import fs from 'fs'; +import path from 'path'; + +describe('Cline Profile Initialization Functionality', () => { + let clineProfileContent; + + beforeAll(() => { + const clineJsPath = path.join( + process.cwd(), + 'scripts', + 'profiles', + 'cline.js' + ); + clineProfileContent = fs.readFileSync(clineJsPath, 'utf8'); + }); + + test('cline.js uses factory pattern with correct configuration', () => { + expect(clineProfileContent).toContain("name: 'cline'"); + expect(clineProfileContent).toContain("displayName: 'Cline'"); + expect(clineProfileContent).toContain("rulesDir: '.clinerules'"); + expect(clineProfileContent).toContain("profileDir: '.clinerules'"); + }); + + test('cline.js configures .mdc to .md extension mapping', () => { + expect(clineProfileContent).toContain("fileExtension: '.mdc'"); + expect(clineProfileContent).toContain("targetExtension: '.md'"); + }); + + test('cline.js uses standard tool mappings', () => { + expect(clineProfileContent).toContain('COMMON_TOOL_MAPPINGS.STANDARD'); + // Should contain comment about standard tool names + expect(clineProfileContent).toContain('standard tool names'); + }); + + test('cline.js contains correct URL configuration', () => { + expect(clineProfileContent).toContain("url: 'cline.bot'"); + expect(clineProfileContent).toContain("docsUrl: 'docs.cline.bot'"); + }); + + test('cline.js has MCP configuration disabled', () => { + expect(clineProfileContent).toContain('mcpConfig: false'); + expect(clineProfileContent).toContain( + "mcpConfigName: 'cline_mcp_settings.json'" + ); + }); + + test('cline.js has custom file mapping for cursor_rules.mdc', () => { + expect(clineProfileContent).toContain('customFileMap:'); + expect(clineProfileContent).toContain( + "'cursor_rules.mdc': 'cline_rules.md'" + ); + }); + + test('cline.js uses createProfile factory function', () => { + expect(clineProfileContent).toContain('createProfile'); + expect(clineProfileContent).toContain('export const clineProfile'); + }); +}); diff --git a/tests/integration/profiles/codex-init-functionality.test.js b/tests/integration/profiles/codex-init-functionality.test.js new file mode 100644 index 00000000..6b8ea009 --- /dev/null +++ b/tests/integration/profiles/codex-init-functionality.test.js @@ -0,0 +1,59 @@ +import fs from 'fs'; +import path from 'path'; + +describe('Codex Profile Initialization Functionality', () => { + let codexProfileContent; + + beforeAll(() => { + const codexJsPath = path.join( + process.cwd(), + 'scripts', + 'profiles', + 'codex.js' + ); + codexProfileContent = fs.readFileSync(codexJsPath, 'utf8'); + }); + + test('codex.js is a simple profile with correct configuration', () => { + expect(codexProfileContent).toContain("profileName: 'codex'"); + expect(codexProfileContent).toContain("displayName: 'Codex'"); + expect(codexProfileContent).toContain("profileDir: '.'"); + expect(codexProfileContent).toContain("rulesDir: '.'"); + }); + + test('codex.js has no MCP configuration', () => { + expect(codexProfileContent).toContain('mcpConfig: false'); + expect(codexProfileContent).toContain('mcpConfigName: null'); + expect(codexProfileContent).toContain('mcpConfigPath: null'); + }); + + test('codex.js has empty file map (simple profile)', () => { + expect(codexProfileContent).toContain('fileMap: {}'); + expect(codexProfileContent).toContain('conversionConfig: {}'); + expect(codexProfileContent).toContain('globalReplacements: []'); + }); + + test('codex.js has lifecycle functions for file management', () => { + expect(codexProfileContent).toContain('function onAddRulesProfile'); + expect(codexProfileContent).toContain('function onRemoveRulesProfile'); + expect(codexProfileContent).toContain('function onPostConvertRulesProfile'); + }); + + test('codex.js copies AGENTS.md to AGENTS.md (same filename)', () => { + expect(codexProfileContent).toContain("'AGENTS.md'"); + expect(codexProfileContent).toContain('copyFileSync'); + // Should copy to the same filename (AGENTS.md) + expect(codexProfileContent).toMatch(/destFile.*AGENTS\.md/); + }); + + test('codex.js has proper error handling', () => { + expect(codexProfileContent).toContain('try {'); + expect(codexProfileContent).toContain('} catch (err) {'); + expect(codexProfileContent).toContain("log('error'"); + }); + + test('codex.js removes AGENTS.md on profile removal', () => { + expect(codexProfileContent).toContain('rmSync'); + expect(codexProfileContent).toContain('force: true'); + }); +});