#12684: Test: add missing unit tests for src/utils modules
stale
Cluster:
Test Coverage Enhancements
#### Summary
Add unit test coverage for three `src/utils` modules that had zero direct tests despite being used in production code:
- **`shell-argv.ts`** (`splitShellArgs`) — used in `src/memory/backend-config.ts`, 0 prior tests
- **`provider-utils.ts`** (`isReasoningTagProvider`) — used across 4 production files (agent runner, compaction, reply handling), 0 prior tests
- **`account-id.ts`** (`normalizeAccountId`) — used in LINE channel accounts, 0 direct tests
#### Gap Covered
These utilities handle argument parsing, provider detection, and ID normalization. Tests cover:
- Happy paths, edge cases (empty/whitespace input, null/undefined)
- `splitShellArgs`: single/double quotes, backslash escaping, unterminated quote detection
- `isReasoningTagProvider`: exact matches, substring matches, case insensitivity, trimming
- `normalizeAccountId`: trimming, empty strings, undefined handling
#### Behavior Changes
None. Pure test additions — no production code modified.
#### Codebase and GitHub Search
- Searched for existing test files: `shell-argv.test.ts`, `provider-utils.test.ts`, `account-id.test.ts` — none exist
- Confirmed test pattern from `src/utils/boolean.test.ts`
- Verified these utils are imported in production code via grep
#### Tests
- 3 new test files, 27 total test cases
- Pattern follows existing `src/utils/boolean.test.ts` conventions
lobster-biscuit
**Sign-Off**
- Submitter effort: manual review of source code + test authoring
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds unit tests for three previously-untested utility modules under `src/utils`: `normalizeAccountId`, `isReasoningTagProvider`, and `splitShellArgs`. The tests follow the existing Vitest co-located test convention (e.g., `src/utils/boolean.test.ts`) and exercise common/edge behaviors like trimming, null/undefined handling, quoted argument parsing, and error cases (unterminated quotes / trailing backslash).
No production code is modified; this PR increases coverage around utilities that are referenced by multiple production paths (provider selection logic, argument parsing, and channel account ID normalization).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge; it only adds test coverage with no production behavior changes.
- Reviewed the added tests against the current implementations of `normalizeAccountId`, `isReasoningTagProvider`, and `splitShellArgs`. Assertions match actual behavior, and no changes touch runtime code paths. Only minor issue is a misleading test description in `shell-argv.test.ts` (assertion is fine, wording is inconsistent).
- src/utils/shell-argv.test.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#20496: test(utils): add comprehensive unit tests for utility functions
by masifislamm · 2026-02-19
85.5%
#15569: test: comprehensive test coverage expansion (57 new test files)
by tangcruz · 2026-02-13
83.9%
#4137: [AI-assisted] test(cli): add missing test cases for parseDurationMs
by sind00 · 2026-01-29
82.5%
#9333: Tests: add test coverage for security/audit-fs.ts
by M00N7682 · 2026-02-05
81.5%
#11421: Tests: add unit tests for infra/format-duration
by PythonUser42 · 2026-02-07
79.4%
#14734: test(agents): guard against stale allowAgents in existing sessions
by davidahmann · 2026-02-12
79.2%
#4095: Test/add format duration tests
by TechWizard9999 · 2026-01-29
78.9%
#4086: Test/add backoff tests
by TechWizard9999 · 2026-01-29
78.7%
#19095: test(discord): add unit tests for presence cache module
by Clawborn · 2026-02-17
78.2%
#8964: test(msteams): add comprehensive tests for graph-upload module
by RajdeepKushwaha5 · 2026-02-04
77.5%