test: add failing test for subagent cost index builder

This commit is contained in:
Igor Velho
2026-08-24 14:45:51 +01:00
parent 97edd033f9
commit 11582ab62b
@@ -0,0 +1,17 @@
import { describe, expect, test } from 'bun:test';
import type { Session } from '@opencode-ai/sdk/v2';
import { buildChildrenIndex } from './subagentCost';
function makeSession(id: string, cost: number, parentID?: string): Session {
return { id, cost, parentID } as unknown as Session;
}
describe('buildChildrenIndex', () => {
test('groups sessions by parentID', () => {
const root = makeSession('root', 1);
const childA = makeSession('a', 2, 'root');
const childB = makeSession('b', 3, 'root');
const index = buildChildrenIndex([root, childA, childB]);
expect(index.get('root')).toEqual([childA, childB]);
});
});