Files
mcpctl/.taskmaster/tasks/task_111.md

77 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

# Task ID: 111
**Title:** Write Integration Tests for subindex Model
**Status:** done
**Dependencies:** 75 ✓, 76 ✓, 82 ✓, 83 ✗
**Priority:** high
**Description:** Create comprehensive integration tests for the subindex proxymodel processing real content through section-split and summarize-tree.
**Details:**
Create `src/mcplocal/tests/proxymodel/subindex.test.ts`:
```typescript
import { describe, it, expect, beforeAll } from 'vitest';
import { executePipeline } from '../../src/proxymodel/executor';
import { loadProxyModels } from '../../src/proxymodel/loader';
import { createMockProviderRegistry } from '../mocks/providers';
describe('subindex proxymodel', () => {
let proxyModel;
let mockRegistry;
beforeAll(async () => {
const models = await loadProxyModels();
proxyModel = models.get('subindex');
mockRegistry = createMockProviderRegistry({
complete: async (prompt) => 'Mock summary of the content',
});
});
it('splits JSON array into sections', async () => {
const content = JSON.stringify([
{ id: 'flow1', label: 'Thermostat', nodes: [] },
{ id: 'flow2', label: 'Lighting', nodes: [] },
]);
const result = await executePipeline({
content,
contentType: 'toolResult',
sourceName: 'test/get_flows',
projectName: 'test',
sessionId: 'test-session',
proxyModel,
providerRegistry: mockRegistry,
});
expect(result.sections).toHaveLength(2);
expect(result.sections[0].id).toBe('flow1');
expect(result.content).toContain('2 sections');
});
it('provides drill-down to exact JSON content', async () => {
// Test that drilling into a section returns exact original JSON
});
it('uses structural summaries for JSON (no LLM call)', async () => {
// Verify LLM not called for JSON content
});
it('uses LLM summaries for prose content', async () => {
// Verify LLM called for markdown content
});
it('caches summaries across requests', async () => {
// Verify cache hit on second request with same content
});
});
```
**Test Strategy:**
Run with vitest, verify all test cases pass, check LLM call counts are as expected (structural vs prose), verify cache behavior.