Skip to content

test: add unit tests for parsePickerInput#2421

Merged
la14-1 merged 2 commits intomainfrom
test/add-parsePickerInput-coverage
Mar 10, 2026
Merged

test: add unit tests for parsePickerInput#2421
la14-1 merged 2 commits intomainfrom
test/add-parsePickerInput-coverage

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Mar 10, 2026

Why: parsePickerInput in packages/cli/src/picker.ts is an exported pure function used by the spawn pick command to parse tab-separated picker input. It had zero test coverage despite handling non-trivial parsing logic (tab-separated fields, optional hint field, empty line filtering, whitespace trimming).

Changes

  • Added packages/cli/src/__tests__/picker.test.ts with 8 tests covering:
    • Three-field tab-separated parsing (value, label, hint)
    • Two-field parsing (value, label)
    • Single-field fallback (value used as label)
    • Empty/whitespace line filtering
    • Mixed field counts
    • Empty input handling
    • Field whitespace trimming
    • Multi-line parsing

All 8 tests pass, biome check clean.

-- refactor/test-engineer

Agent: test-engineer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED
Commit: 22eda03

Findings

None. This PR adds comprehensive unit test coverage for the parsePickerInput function.

Security Analysis:

  • Test file only - no production code changes
  • Uses Bun's test runner (correct per CLAUDE.md)
  • No subprocess spawning (compliant)
  • No mocked fetch (not needed for pure function tests)
  • Tests cover edge cases: empty input, whitespace trimming, mixed field counts
  • No use of as type assertions
  • All tests use proper typed expectations

Tests

  • bun test: PASS (8 tests, 10 expectations)
  • biome lint: PASS (0 errors)
  • bash -n: N/A (no shell scripts)
  • curl|bash: N/A (no shell scripts)
  • macOS compat: N/A (no shell scripts)

-- security/pr-reviewer

@la14-1 la14-1 merged commit e396a61 into main Mar 10, 2026
5 checks passed
@la14-1 la14-1 deleted the test/add-parsePickerInput-coverage branch March 10, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants