Files
claude-task-master/tests/unit/profiles/rule-transformer-gemini.test.js
Joe Danziger 95c299df64 Unify and streamline profile system architecture (#853)
* move claude rules and commands to assets/claude

* update claude profile to copy assets/claude to .claude

* fix formatting

* feat(profiles): Implement unified profile system

- Convert Claude and Codex profiles to use createProfile() factory
- Remove simple vs complex profile distinction in rule transformer
- Unify convertAllRulesToProfileRules() to handle all profiles consistently
- Fix mcpConfigPath construction in base-profile.js for null mcpConfigName
- Update terminology from 'simpleProfiles' to 'assetOnlyProfiles' throughout
- Ensure Claude .claude directory copying works in both CLI and MCP contexts
- All profiles now follow same execution flow with proper lifecycle functions

Changes:
- src/profiles/claude.js: Convert to createProfile() factory pattern
- src/profiles/codex.js: Convert to createProfile() factory pattern
- src/utils/rule-transformer.js: Unified profile handling logic
- src/utils/profiles.js: Remove simple profile categorization
- src/profiles/base-profile.js: Fix mcpConfigPath construction
- scripts/modules/commands.js: Update variable naming
- tests/: Update all tests for unified system and terminology

Fixes Claude profile asset copying issue in MCP context.
All tests passing (617 passed, 11 skipped).

* re-checkin claude files

* fix formatting

* chore: clean up test Claude rules files

* chore: add changeset for unified profile system

* add claude files back

* add changeset

* restore proper gitignore

* remove claude agents file from root

* remove incorrect doc

* simplify profiles and update tests

* update changeset

* update changeset

* remove profile specific code

* streamline profiles with defaults and update tests

* update changeset

* add newline at end of gitignore

* restore changes

* streamline profiles with defaults; update tests and add vscode test

* update rule profile tests

* update wording for clearer profile management

* refactor and clarify terminology

* use original projectRoot var name

* revert param desc

* use updated claude assets from neno

* add "YOUR_" before api key here

* streamline codex profile

* add gemini profile

* update gemini profile

* update tests

* relocate function

* update rules interactive setup Gemini desc

* remove duplicative code

* add comma
2025-07-09 13:22:11 +02:00

71 lines
2.7 KiB
JavaScript

import { jest } from '@jest/globals';
import { getRulesProfile } from '../../../src/utils/rule-transformer.js';
import { geminiProfile } from '../../../src/profiles/gemini.js';
describe('Rule Transformer - Gemini Profile', () => {
test('should have correct profile configuration', () => {
const geminiProfile = getRulesProfile('gemini');
expect(geminiProfile).toBeDefined();
expect(geminiProfile.profileName).toBe('gemini');
expect(geminiProfile.displayName).toBe('Gemini');
expect(geminiProfile.profileDir).toBe('.gemini');
expect(geminiProfile.rulesDir).toBe('.');
expect(geminiProfile.mcpConfig).toBe(true);
expect(geminiProfile.mcpConfigName).toBe('settings.json');
expect(geminiProfile.mcpConfigPath).toBe('.gemini/settings.json');
expect(geminiProfile.includeDefaultRules).toBe(false);
expect(geminiProfile.fileMap).toEqual({
'AGENTS.md': 'GEMINI.md'
});
});
test('should have minimal profile implementation', () => {
// Verify that gemini.js is minimal (no lifecycle functions)
expect(geminiProfile.onAddRulesProfile).toBeUndefined();
expect(geminiProfile.onRemoveRulesProfile).toBeUndefined();
expect(geminiProfile.onPostConvertRulesProfile).toBeUndefined();
});
test('should use settings.json instead of mcp.json', () => {
const geminiProfile = getRulesProfile('gemini');
expect(geminiProfile.mcpConfigName).toBe('settings.json');
expect(geminiProfile.mcpConfigPath).toBe('.gemini/settings.json');
});
test('should not include default rules', () => {
const geminiProfile = getRulesProfile('gemini');
expect(geminiProfile.includeDefaultRules).toBe(false);
});
test('should have correct file mapping', () => {
const geminiProfile = getRulesProfile('gemini');
expect(geminiProfile.fileMap).toEqual({
'AGENTS.md': 'GEMINI.md'
});
});
test('should place GEMINI.md in root directory', () => {
const geminiProfile = getRulesProfile('gemini');
// rulesDir determines where fileMap files go
expect(geminiProfile.rulesDir).toBe('.');
// This means AGENTS.md -> GEMINI.md will be placed in the root
});
test('should place settings.json in .gemini directory', () => {
const geminiProfile = getRulesProfile('gemini');
// profileDir + mcpConfigName determines MCP config location
expect(geminiProfile.profileDir).toBe('.gemini');
expect(geminiProfile.mcpConfigName).toBe('settings.json');
expect(geminiProfile.mcpConfigPath).toBe('.gemini/settings.json');
});
test('should have proper conversion config', () => {
const geminiProfile = getRulesProfile('gemini');
// Gemini should have the standard conversion config
expect(geminiProfile.conversionConfig).toBeDefined();
expect(geminiProfile.globalReplacements).toBeDefined();
expect(Array.isArray(geminiProfile.globalReplacements)).toBe(true);
});
});