chore: fix format

This commit is contained in:
Ralph Khreish
2025-09-08 18:30:40 -07:00
parent 84baedc3d2
commit 7582219365
3 changed files with 31 additions and 20 deletions

View File

@@ -103,10 +103,14 @@ describe('Roo Files Inclusion in Package', () => {
test('source Roo files exist in public/assets directory', () => { test('source Roo files exist in public/assets directory', () => {
// Verify that the source files for Roo integration exist // Verify that the source files for Roo integration exist
expect( expect(
fs.existsSync(path.join(process.cwd(), 'public', 'assets', 'roocode', '.roo')) fs.existsSync(
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roo')
)
).toBe(true); ).toBe(true);
expect( expect(
fs.existsSync(path.join(process.cwd(), 'public', 'assets', 'roocode', '.roomodes')) fs.existsSync(
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roomodes')
)
).toBe(true); ).toBe(true);
}); });
}); });

View File

@@ -89,10 +89,14 @@ describe('Rules Files Inclusion in Package', () => {
test('source Roo files exist in public/assets directory', () => { test('source Roo files exist in public/assets directory', () => {
// Verify that the source files for Roo integration exist // Verify that the source files for Roo integration exist
expect( expect(
fs.existsSync(path.join(process.cwd(), 'public', 'assets', 'roocode', '.roo')) fs.existsSync(
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roo')
)
).toBe(true); ).toBe(true);
expect( expect(
fs.existsSync(path.join(process.cwd(), 'public', 'assets', 'roocode', '.roomodes')) fs.existsSync(
path.join(process.cwd(), 'public', 'assets', 'roocode', '.roomodes')
)
).toBe(true); ).toBe(true);
}); });
}); });

View File

@@ -62,11 +62,11 @@ describe('PromptManager', () => {
describe('loadPrompt', () => { describe('loadPrompt', () => {
it('should load and render a prompt from actual files', () => { it('should load and render a prompt from actual files', () => {
// Test with an actual prompt that exists // Test with an actual prompt that exists
const result = promptManager.loadPrompt('research', { const result = promptManager.loadPrompt('research', {
query: 'test query', query: 'test query',
projectContext: 'test context' projectContext: 'test context'
}); });
expect(result.systemPrompt).toBeDefined(); expect(result.systemPrompt).toBeDefined();
expect(result.userPrompt).toBeDefined(); expect(result.userPrompt).toBeDefined();
expect(result.userPrompt).toContain('test query'); expect(result.userPrompt).toContain('test query');
@@ -87,7 +87,7 @@ describe('PromptManager', () => {
}); });
const result = promptManager.loadPrompt('test-prompt', { name: 'John' }); const result = promptManager.loadPrompt('test-prompt', { name: 'John' });
expect(result.userPrompt).toBe('Hello John, your age is '); expect(result.userPrompt).toBe('Hello John, your age is ');
}); });
@@ -100,13 +100,13 @@ describe('PromptManager', () => {
it('should use cache for repeated calls', () => { it('should use cache for repeated calls', () => {
// First call with a real prompt // First call with a real prompt
const result1 = promptManager.loadPrompt('research', { query: 'test' }); const result1 = promptManager.loadPrompt('research', { query: 'test' });
// Mark the result to verify cache is used // Mark the result to verify cache is used
result1._cached = true; result1._cached = true;
// Second call with same parameters should return cached result // Second call with same parameters should return cached result
const result2 = promptManager.loadPrompt('research', { query: 'test' }); const result2 = promptManager.loadPrompt('research', { query: 'test' });
expect(result2._cached).toBe(true); expect(result2._cached).toBe(true);
expect(result1).toBe(result2); // Same object reference expect(result1).toBe(result2); // Same object reference
}); });
@@ -127,7 +127,7 @@ describe('PromptManager', () => {
const result = promptManager.loadPrompt('array-prompt', { const result = promptManager.loadPrompt('array-prompt', {
items: ['one', 'two', 'three'] items: ['one', 'two', 'three']
}); });
// The actual implementation doesn't handle {{this}} properly, check what it does produce // The actual implementation doesn't handle {{this}} properly, check what it does produce
expect(result.userPrompt).toContain('Item:'); expect(result.userPrompt).toContain('Item:');
}); });
@@ -145,10 +145,14 @@ describe('PromptManager', () => {
} }
}); });
const withData = promptManager.loadPrompt('conditional-prompt', { hasData: true }); const withData = promptManager.loadPrompt('conditional-prompt', {
hasData: true
});
expect(withData.userPrompt).toBe('Data exists'); expect(withData.userPrompt).toBe('Data exists');
const withoutData = promptManager.loadPrompt('conditional-prompt', { hasData: false }); const withoutData = promptManager.loadPrompt('conditional-prompt', {
hasData: false
});
expect(withoutData.userPrompt).toBe('No data'); expect(withoutData.userPrompt).toBe('No data');
}); });
}); });
@@ -162,7 +166,7 @@ describe('PromptManager', () => {
age: 30 age: 30
} }
}; };
const result = promptManager.renderTemplate(template, variables); const result = promptManager.renderTemplate(template, variables);
expect(result).toBe('User: John, Age: 30'); expect(result).toBe('User: John, Age: 30');
}); });
@@ -172,7 +176,7 @@ describe('PromptManager', () => {
const variables = { const variables = {
special: '<>&"\'' special: '<>&"\''
}; };
const result = promptManager.renderTemplate(template, variables); const result = promptManager.renderTemplate(template, variables);
expect(result).toBe('Special: <>&"\''); expect(result).toBe('Special: <>&"\'');
}); });
@@ -183,8 +187,8 @@ describe('PromptManager', () => {
const prompts = promptManager.listPrompts(); const prompts = promptManager.listPrompts();
expect(prompts).toBeInstanceOf(Array); expect(prompts).toBeInstanceOf(Array);
expect(prompts.length).toBeGreaterThan(0); expect(prompts.length).toBeGreaterThan(0);
const ids = prompts.map(p => p.id); const ids = prompts.map((p) => p.id);
expect(ids).toContain('analyze-complexity'); expect(ids).toContain('analyze-complexity');
expect(ids).toContain('expand-task'); expect(ids).toContain('expand-task');
expect(ids).toContain('add-task'); expect(ids).toContain('add-task');
@@ -192,7 +196,6 @@ describe('PromptManager', () => {
}); });
}); });
describe('validateTemplate', () => { describe('validateTemplate', () => {
it('should validate a correct template', () => { it('should validate a correct template', () => {
const result = promptManager.validateTemplate('research'); const result = promptManager.validateTemplate('research');
@@ -202,7 +205,7 @@ describe('PromptManager', () => {
it('should reject invalid template', () => { it('should reject invalid template', () => {
const result = promptManager.validateTemplate('non-existent'); const result = promptManager.validateTemplate('non-existent');
expect(result.valid).toBe(false); expect(result.valid).toBe(false);
expect(result.error).toContain("not found"); expect(result.error).toContain('not found');
}); });
}); });
}); });