Files
codetyper.cli/test/file-picker.test.ts
Carlos Gutierrez 187cc68304 Improve agent autonomy and diff view readability
Agent behavior improvements:
  - Add project context detection (tsconfig.json, pom.xml, etc.)
  - Enforce validation after changes (tsc --noEmit, mvn compile, etc.)
  - Run tests automatically - never ask "do you want me to run tests"
  - Complete full loop: create → type-check → test → confirm
  - Add command detection for direct execution (run tree, run ls)

  Diff view improvements:
  - Use darker backgrounds for added/removed lines
  - Add diffLineBgAdded, diffLineBgRemoved, diffLineText theme colors
  - Improve text visibility with white text on dark backgrounds
  - Update both React/Ink and SolidJS diff components

  Streaming fixes:
  - Fix tool call argument accumulation using OpenAI index field
  - Fix streaming content display after tool calls
  - Add consecutive error tracking to prevent token waste

  Other changes:
  - ESC to abort operations, Ctrl+C to exit
  - Fix model selection when provider changes in cascade mode
  - Add debug logging for troubleshooting
  - Move tests to root tests/ folder
  - Fix banner test GRADIENT_COLORS reference
2026-01-29 07:33:30 -05:00

60 lines
2.0 KiB
TypeScript

/**
* @file file-picker.test.ts
* @description Unit tests for file-picker.ts constants
*/
import { IGNORED_PATTERNS, BINARY_EXTENSIONS, FILE_PICKER_DEFAULTS, BinaryExtension, IgnoredPattern } from '../src/constants/file-picker';
describe('file-picker constants', () => {
describe('IGNORED_PATTERNS', () => {
it('should be an array of strings', () => {
expect(Array.isArray(IGNORED_PATTERNS)).toBe(true);
IGNORED_PATTERNS.forEach(pattern => {
expect(typeof pattern).toBe('string');
});
});
it('should contain common ignored patterns', () => {
expect(IGNORED_PATTERNS).toContain('.git');
expect(IGNORED_PATTERNS).toContain('node_modules');
expect(IGNORED_PATTERNS).toContain('.DS_Store');
});
});
describe('BINARY_EXTENSIONS', () => {
it('should be an array of strings', () => {
expect(Array.isArray(BINARY_EXTENSIONS)).toBe(true);
BINARY_EXTENSIONS.forEach(ext => {
expect(typeof ext).toBe('string');
});
});
it('should contain common binary file extensions', () => {
expect(BINARY_EXTENSIONS).toContain('.exe');
expect(BINARY_EXTENSIONS).toContain('.png');
expect(BINARY_EXTENSIONS).toContain('.mp3');
expect(BINARY_EXTENSIONS).toContain('.zip');
expect(BINARY_EXTENSIONS).toContain('.pdf');
});
});
describe('FILE_PICKER_DEFAULTS', () => {
it('should have correct default values', () => {
expect(FILE_PICKER_DEFAULTS.MAX_DEPTH).toBe(2);
expect(FILE_PICKER_DEFAULTS.MAX_RESULTS).toBe(15);
expect(FILE_PICKER_DEFAULTS.INITIAL_DEPTH).toBe(0);
});
});
describe('Type Definitions', () => {
it('BinaryExtension should include specific extensions', () => {
const binaryExtension: BinaryExtension = '.exe';
expect(BINARY_EXTENSIONS).toContain(binaryExtension);
});
it('IgnoredPattern should include specific patterns', () => {
const ignoredPattern: IgnoredPattern = '.git';
expect(IGNORED_PATTERNS).toContain(ignoredPattern);
});
});
});