update test cases to match code

This commit is contained in:
Pedram Amini
2026-01-29 09:30:52 -05:00
parent cd5f029445
commit be5fc86ebf
6 changed files with 26 additions and 12 deletions

View File

@@ -333,7 +333,7 @@ describe('storage service', () => {
const configs = {
configs: {
'claude-code': { customPath: '/custom/path' },
aider: { setting: 'value' },
'factory-droid': { setting: 'value' },
},
};
vi.mocked(fs.readFileSync).mockReturnValue(JSON.stringify(configs));

View File

@@ -43,7 +43,7 @@ vi.mock('../../../renderer/services/contextGroomer', () => ({
'claude-code': 'Claude Code',
opencode: 'OpenCode',
codex: 'OpenAI Codex',
factory-droid: 'Factory Droid',
'factory-droid': 'Factory Droid',
terminal: 'Terminal',
};
return names[toolType] || toolType;

View File

@@ -37,7 +37,7 @@ vi.mock('../../../renderer/services/contextGroomer', () => ({
'claude-code': 'Claude Code',
opencode: 'OpenCode',
codex: 'OpenAI Codex',
factory-droid: 'Factory Droid',
'factory-droid': 'Factory Droid',
terminal: 'Terminal',
};
return names[toolType] || toolType;

View File

@@ -30,7 +30,7 @@ const mockData: StatsAggregation = {
avgDuration: 72000, // 72 seconds
byAgent: {
'claude-code': { count: 30, duration: 2000000 },
aider: { count: 20, duration: 1600000 },
'factory-droid': { count: 20, duration: 1600000 },
terminal: { count: 10, duration: 500000 },
},
bySource: { user: 35, auto: 15 },
@@ -59,7 +59,7 @@ const manyAgentsData: StatsAggregation = {
avgDuration: 50000,
byAgent: {
'claude-code': { count: 30, duration: 1500000 },
aider: { count: 25, duration: 1200000 },
'factory-droid': { count: 25, duration: 1200000 },
terminal: { count: 15, duration: 800000 },
opencode: { count: 12, duration: 600000 },
gemini: { count: 10, duration: 500000 },

View File

@@ -186,7 +186,7 @@ describe('substituteTemplateVariables', () => {
session: createTestSession({ toolType: 'factory-droid' }),
});
const result = substituteTemplateVariables('Tool: {{TOOL_TYPE}}', context);
expect(result).toBe('Tool: aider');
expect(result).toBe('Tool: factory-droid');
});
it('should replace {{TAB_NAME}} with session.name', () => {

View File

@@ -348,7 +348,9 @@ describe('SessionStatusBanner', () => {
expect(screen.getByText('100%')).toBeInTheDocument();
});
it('does not render when contextWindow is 0', () => {
it('uses default context window when contextWindow is 0', () => {
// When contextWindow is 0, estimateContextUsage falls back to
// agent-specific default context window (200000 for claude-code)
const usageStats = createUsageStats({
inputTokens: 1000,
outputTokens: 500,
@@ -358,10 +360,15 @@ describe('SessionStatusBanner', () => {
render(<SessionStatusBanner session={session} />);
expect(screen.queryByRole('progressbar')).toBeNull();
// Should render with fallback context window
// 1000 / 200000 * 100 = 0.5% rounds to 1%
expect(screen.getByRole('progressbar')).toBeInTheDocument();
expect(screen.getByText('1%')).toBeInTheDocument();
});
it('does not render when contextWindow is undefined', () => {
it('uses default context window when contextWindow is undefined', () => {
// When contextWindow is undefined, estimateContextUsage falls back to
// agent-specific default context window (200000 for claude-code)
const usageStats = createUsageStats({
inputTokens: 1000,
outputTokens: 500,
@@ -371,10 +378,15 @@ describe('SessionStatusBanner', () => {
render(<SessionStatusBanner session={session} />);
expect(screen.queryByRole('progressbar')).toBeNull();
// Should render with fallback context window
// 1000 / 200000 * 100 = 0.5% rounds to 1%
expect(screen.getByRole('progressbar')).toBeInTheDocument();
expect(screen.getByText('1%')).toBeInTheDocument();
});
it('does not render when inputTokens is undefined', () => {
it('renders with 0% when inputTokens is undefined', () => {
// When inputTokens is undefined, it defaults to 0
// 0 / 200000 * 100 = 0%
const usageStats = createUsageStats({
inputTokens: undefined,
outputTokens: 500,
@@ -384,7 +396,9 @@ describe('SessionStatusBanner', () => {
render(<SessionStatusBanner session={session} />);
expect(screen.queryByRole('progressbar')).toBeNull();
// Should render with 0% usage
expect(screen.getByRole('progressbar')).toBeInTheDocument();
expect(screen.getByText('0%')).toBeInTheDocument();
});
it('does not render when usageStats is null', () => {