feat: Add OpenCode rule profile with AGENTS.md and MCP config (#970)
* add opencode to profile lists * add opencode profile / modify mcp config after add * add changeset * not necessary; main config being updated * add issue link * add/fix tests * fix url and docsUrl * update test for new urls * fix formatting * update/fix tests
This commit is contained in:
59
tests/unit/profiles/rule-transformer-opencode.test.js
Normal file
59
tests/unit/profiles/rule-transformer-opencode.test.js
Normal file
@@ -0,0 +1,59 @@
|
||||
import { jest } from '@jest/globals';
|
||||
import { getRulesProfile } from '../../../src/utils/rule-transformer.js';
|
||||
import { opencodeProfile } from '../../../src/profiles/opencode.js';
|
||||
|
||||
describe('Rule Transformer - OpenCode Profile', () => {
|
||||
test('should have correct profile configuration', () => {
|
||||
const opencodeProfile = getRulesProfile('opencode');
|
||||
|
||||
expect(opencodeProfile).toBeDefined();
|
||||
expect(opencodeProfile.profileName).toBe('opencode');
|
||||
expect(opencodeProfile.displayName).toBe('OpenCode');
|
||||
expect(opencodeProfile.profileDir).toBe('.');
|
||||
expect(opencodeProfile.rulesDir).toBe('.');
|
||||
expect(opencodeProfile.mcpConfig).toBe(true);
|
||||
expect(opencodeProfile.mcpConfigName).toBe('opencode.json');
|
||||
expect(opencodeProfile.mcpConfigPath).toBe('opencode.json');
|
||||
expect(opencodeProfile.includeDefaultRules).toBe(false);
|
||||
expect(opencodeProfile.fileMap).toEqual({
|
||||
'AGENTS.md': 'AGENTS.md'
|
||||
});
|
||||
});
|
||||
|
||||
test('should have lifecycle functions for MCP config transformation', () => {
|
||||
// Verify that opencode.js has lifecycle functions
|
||||
expect(opencodeProfile.onPostConvertRulesProfile).toBeDefined();
|
||||
expect(typeof opencodeProfile.onPostConvertRulesProfile).toBe('function');
|
||||
expect(opencodeProfile.onRemoveRulesProfile).toBeDefined();
|
||||
expect(typeof opencodeProfile.onRemoveRulesProfile).toBe('function');
|
||||
});
|
||||
|
||||
test('should use opencode.json instead of mcp.json', () => {
|
||||
const opencodeProfile = getRulesProfile('opencode');
|
||||
expect(opencodeProfile.mcpConfigName).toBe('opencode.json');
|
||||
expect(opencodeProfile.mcpConfigPath).toBe('opencode.json');
|
||||
});
|
||||
|
||||
test('should not include default rules', () => {
|
||||
const opencodeProfile = getRulesProfile('opencode');
|
||||
expect(opencodeProfile.includeDefaultRules).toBe(false);
|
||||
});
|
||||
|
||||
test('should have correct file mapping', () => {
|
||||
const opencodeProfile = getRulesProfile('opencode');
|
||||
expect(opencodeProfile.fileMap).toEqual({
|
||||
'AGENTS.md': 'AGENTS.md'
|
||||
});
|
||||
});
|
||||
|
||||
test('should use root directory for both profile and rules', () => {
|
||||
const opencodeProfile = getRulesProfile('opencode');
|
||||
expect(opencodeProfile.profileDir).toBe('.');
|
||||
expect(opencodeProfile.rulesDir).toBe('.');
|
||||
});
|
||||
|
||||
test('should have MCP configuration enabled', () => {
|
||||
const opencodeProfile = getRulesProfile('opencode');
|
||||
expect(opencodeProfile.mcpConfig).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user