#12087: Add comprehensive tests for markdown code-spans module
size: S
Cluster:
Test Coverage Enhancements
- Tests for createInlineCodeState initialization
- Tests for buildCodeSpanIndex with various scenarios:
- Basic inline code detection
- Multiple code spans
- Fence detection and edge cases
- Multiple backtick counts
- Unclosed code spans with state preservation
- Edge cases (empty string, no backticks, consecutive spans, etc.)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds a new Vitest suite for `src/markdown/code-spans.ts`, covering `createInlineCodeState()` initialization and a variety of `buildCodeSpanIndex()` scenarios (single/multiple inline spans, differing backtick run lengths, fences, and unclosed spans with carry-over state). The tests exercise the module’s current `isInside()` semantics, which treat being inside a fenced block as well as inside an inline-code span as `true`.
<h3>Confidence Score: 4/5</h3>
- Safe to merge after clarifying a couple of misleading test expectations/comments.
- Changes are test-only and align with current code-spans implementation, but some test names/comments misdescribe what indices represent and why fenced regions return true, which is likely to confuse maintenance and future refactors.
- src/markdown/code-spans.test.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</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
#12684: Test: add missing unit tests for src/utils modules
by shaynhornik · 2026-02-09
75.5%
#15569: test: comprehensive test coverage expansion (57 new test files)
by tangcruz · 2026-02-13
74.6%
#9333: Tests: add test coverage for security/audit-fs.ts
by M00N7682 · 2026-02-05
73.8%
#8964: test(msteams): add comprehensive tests for graph-upload module
by RajdeepKushwaha5 · 2026-02-04
73.5%
#11421: Tests: add unit tests for infra/format-duration
by PythonUser42 · 2026-02-07
73.3%
#2716: Fix #2678: markdown horizontal rules not rendering in web chat
by Ambar-13 · 2026-01-27
72.5%
#20496: test(utils): add comprehensive unit tests for utility functions
by masifislamm · 2026-02-19
72.2%
#4095: Test/add format duration tests
by TechWizard9999 · 2026-01-29
72.0%
#12876: major test workflow: enhance coverage infrastructure
by Mathbkj · 2026-02-09
71.8%
#13318: fix(agents): prevent sanitizeUserFacingText from rewriting conversa...
by hleliofficiel · 2026-02-10
70.9%