satisfying test errors

This commit is contained in:
trueheads
2025-12-22 02:06:17 -06:00
parent 0cd3275e4a
commit 73cab38ba5
3 changed files with 46 additions and 56 deletions

View File

@@ -24,12 +24,12 @@ describe('model-resolver.ts', () => {
describe('resolveModelString', () => {
it("should resolve 'haiku' alias to full model string", () => {
const result = resolveModelString('haiku');
expect(result).toBe('claude-haiku-4-5');
expect(result).toBe(CLAUDE_MODEL_MAP.haiku);
});
it("should resolve 'sonnet' alias to full model string", () => {
const result = resolveModelString('sonnet');
expect(result).toBe('claude-sonnet-4-20250514');
expect(result).toBe(CLAUDE_MODEL_MAP.sonnet);
});
it("should resolve 'opus' alias to full model string", () => {
@@ -50,7 +50,7 @@ describe('model-resolver.ts', () => {
});
it('should pass through full Claude model strings', () => {
const models = ['claude-opus-4-5-20251101', 'claude-sonnet-4-20250514', 'claude-haiku-4-5'];
const models = [CLAUDE_MODEL_MAP.opus, CLAUDE_MODEL_MAP.sonnet, CLAUDE_MODEL_MAP.haiku];
models.forEach((model) => {
const result = resolveModelString(model);
expect(result).toBe(model);
@@ -93,11 +93,11 @@ describe('model-resolver.ts', () => {
it('should use session model when explicit is not provided', () => {
const result = getEffectiveModel(undefined, 'sonnet', 'gpt-5.2');
expect(result).toBe('claude-sonnet-4-20250514');
expect(result).toBe(CLAUDE_MODEL_MAP.sonnet);
});
it('should use default when neither explicit nor session is provided', () => {
const customDefault = 'claude-haiku-4-5';
const customDefault = CLAUDE_MODEL_MAP.haiku;
const result = getEffectiveModel(undefined, undefined, customDefault);
expect(result).toBe(customDefault);
});
@@ -109,7 +109,7 @@ describe('model-resolver.ts', () => {
it('should handle explicit empty strings as undefined', () => {
const result = getEffectiveModel('', 'haiku');
expect(result).toBe('claude-haiku-4-5');
expect(result).toBe(CLAUDE_MODEL_MAP.haiku);
});
});

View File

@@ -307,10 +307,10 @@ describe('claude-provider.ts', () => {
expect(sonnet35).toBeDefined();
});
it('should include Claude 3.5 Haiku', () => {
it('should include Claude Haiku 4.5', () => {
const models = provider.getAvailableModels();
const haiku = models.find((m) => m.id === 'claude-3-5-haiku-20241022');
const haiku = models.find((m) => m.id === 'claude-haiku-4-5-20251001');
expect(haiku).toBeDefined();
});

View File

@@ -46,28 +46,25 @@ test.describe('Context View - File Management', () => {
await navigateToContext(page);
// Click Add File button
await clickElement(page, 'add-context-file');
await page.waitForSelector('[data-testid="add-context-dialog"]', {
// Click Create Markdown button
await clickElement(page, 'create-markdown-button');
await page.waitForSelector('[data-testid="create-markdown-dialog"]', {
timeout: 5000,
});
// Select text type (should be default)
await clickElement(page, 'add-text-type');
// Enter filename
await fillInput(page, 'new-file-name', 'test-context.md');
await fillInput(page, 'new-markdown-name', 'test-context.md');
// Enter content
const testContent = '# Test Context\n\nThis is test content';
await fillInput(page, 'new-file-content', testContent);
await fillInput(page, 'new-markdown-content', testContent);
// Click confirm
await clickElement(page, 'confirm-add-file');
await clickElement(page, 'confirm-create-markdown');
// Wait for dialog to close
await page.waitForFunction(
() => !document.querySelector('[data-testid="add-context-dialog"]'),
() => !document.querySelector('[data-testid="create-markdown-dialog"]'),
{ timeout: 5000 }
);
@@ -362,26 +359,23 @@ test.describe('Context View - Drag and Drop', () => {
await navigateToContext(page);
// Open add file dialog
await clickElement(page, 'add-context-file');
await page.waitForSelector('[data-testid="add-context-dialog"]', {
// Open create markdown dialog
await clickElement(page, 'create-markdown-button');
await page.waitForSelector('[data-testid="create-markdown-dialog"]', {
timeout: 5000,
});
// Ensure text type is selected
await clickElement(page, 'add-text-type');
// Simulate drag and drop of a .md file onto the textarea
const droppedContent = '# Dropped Content\n\nThis was dragged and dropped.';
await simulateFileDrop(
page,
'[data-testid="new-file-content"]',
'[data-testid="new-markdown-content"]',
'dropped-file.md',
droppedContent
);
// Wait for content to be populated in textarea
const textarea = await getByTestId(page, 'new-file-content');
const textarea = await getByTestId(page, 'new-markdown-content');
await textarea.waitFor({ state: 'visible' });
await expect(textarea).toHaveValue(droppedContent);
@@ -390,15 +384,15 @@ test.describe('Context View - Drag and Drop', () => {
expect(textareaContent).toBe(droppedContent);
// Verify filename is auto-filled
const filenameValue = await page.locator('[data-testid="new-file-name"]').inputValue();
const filenameValue = await page.locator('[data-testid="new-markdown-name"]').inputValue();
expect(filenameValue).toBe('dropped-file.md');
// Confirm and create the file
await clickElement(page, 'confirm-add-file');
await clickElement(page, 'confirm-create-markdown');
// Wait for dialog to close
await page.waitForFunction(
() => !document.querySelector('[data-testid="add-context-dialog"]'),
() => !document.querySelector('[data-testid="create-markdown-dialog"]'),
{ timeout: 5000 }
);
@@ -473,20 +467,19 @@ test.describe('Context View - Edge Cases', () => {
await expect(originalFile).toBeVisible();
// Try to create another file with the same name
await clickElement(page, 'add-context-file');
await page.waitForSelector('[data-testid="add-context-dialog"]', {
await clickElement(page, 'create-markdown-button');
await page.waitForSelector('[data-testid="create-markdown-dialog"]', {
timeout: 5000,
});
await clickElement(page, 'add-text-type');
await fillInput(page, 'new-file-name', 'test.md');
await fillInput(page, 'new-file-content', '# New Content - Overwritten');
await fillInput(page, 'new-markdown-name', 'test.md');
await fillInput(page, 'new-markdown-content', '# New Content - Overwritten');
await clickElement(page, 'confirm-add-file');
await clickElement(page, 'confirm-create-markdown');
// Wait for dialog to close
await page.waitForFunction(
() => !document.querySelector('[data-testid="add-context-dialog"]'),
() => !document.querySelector('[data-testid="create-markdown-dialog"]'),
{ timeout: 5000 }
);
@@ -518,18 +511,17 @@ test.describe('Context View - Edge Cases', () => {
await navigateToContext(page);
// Test file with parentheses
await clickElement(page, 'add-context-file');
await page.waitForSelector('[data-testid="add-context-dialog"]', {
await clickElement(page, 'create-markdown-button');
await page.waitForSelector('[data-testid="create-markdown-dialog"]', {
timeout: 5000,
});
await clickElement(page, 'add-text-type');
await fillInput(page, 'new-file-name', 'context (1).md');
await fillInput(page, 'new-file-content', 'Content with parentheses in filename');
await fillInput(page, 'new-markdown-name', 'context (1).md');
await fillInput(page, 'new-markdown-content', 'Content with parentheses in filename');
await clickElement(page, 'confirm-add-file');
await clickElement(page, 'confirm-create-markdown');
await page.waitForFunction(
() => !document.querySelector('[data-testid="add-context-dialog"]'),
() => !document.querySelector('[data-testid="create-markdown-dialog"]'),
{ timeout: 5000 }
);
@@ -538,18 +530,17 @@ test.describe('Context View - Edge Cases', () => {
await expect(fileWithParens).toBeVisible();
// Test file with hyphens and underscores
await clickElement(page, 'add-context-file');
await page.waitForSelector('[data-testid="add-context-dialog"]', {
await clickElement(page, 'create-markdown-button');
await page.waitForSelector('[data-testid="create-markdown-dialog"]', {
timeout: 5000,
});
await clickElement(page, 'add-text-type');
await fillInput(page, 'new-file-name', 'test-file_v2.md');
await fillInput(page, 'new-file-content', 'Content with hyphens and underscores');
await fillInput(page, 'new-markdown-name', 'test-file_v2.md');
await fillInput(page, 'new-markdown-content', 'Content with hyphens and underscores');
await clickElement(page, 'confirm-add-file');
await clickElement(page, 'confirm-create-markdown');
await page.waitForFunction(
() => !document.querySelector('[data-testid="add-context-dialog"]'),
() => !document.querySelector('[data-testid="create-markdown-dialog"]'),
{ timeout: 5000 }
);
@@ -582,18 +573,17 @@ test.describe('Context View - Edge Cases', () => {
await navigateToContext(page);
// Create file with empty content
await clickElement(page, 'add-context-file');
await page.waitForSelector('[data-testid="add-context-dialog"]', {
await clickElement(page, 'create-markdown-button');
await page.waitForSelector('[data-testid="create-markdown-dialog"]', {
timeout: 5000,
});
await clickElement(page, 'add-text-type');
await fillInput(page, 'new-file-name', 'empty-file.md');
await fillInput(page, 'new-markdown-name', 'empty-file.md');
// Don't fill any content - leave it empty
await clickElement(page, 'confirm-add-file');
await clickElement(page, 'confirm-create-markdown');
await page.waitForFunction(
() => !document.querySelector('[data-testid="add-context-dialog"]'),
() => !document.querySelector('[data-testid="create-markdown-dialog"]'),
{ timeout: 5000 }
);