Skip to content

fix: Add Unit Tests for markdownEditorUtils.ts #646

@23harshitkumar

Description

@23harshitkumar

Problem

The src/utils/markdownEditorUtils.ts file contains 11 utility functions (366 lines of code) that handle critical markdown editing operations in the Monaco editor, but it currently has zero unit test coverage. Previously, the entire utils/ directory only had tests for compression.ts and errorUtils.ts , leaving core editor utilities completely untested.

These functions are responsible for:

  • Parsing line content and whitespace
  • Detecting markdown prefixes (bullets, blockquotes, headings)
  • creating editor edit operations
  • toggling list prefixes and wrapped edits

Without such tests, regressions in these utilities could break the markdown editing experience silently.

Solution :

Add comprehensive unit tests for utility functions in markdownEditorUtils.ts and soome edge cases and integeration tests too.

Benefits:

  • Improve test coverage: Adding tests for markdownEditorUtils.ts would significantly increase the project's unit test coverage.
  • Prevent regressions: These utilities are critical for the markdown editing experience, tests would catch break downs early.
  • Enable safe refactoring: with proper test coverage, future contributors can confidently optimize or modify these utilities
  • Tests would demonstrate expected function behavior, helping new contributors understand the codebase

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions