Skip to content

[Test]:Missing unit tests for critical rendering logic in Markdown and Tag components #1217

@SHUBHANSHU602

Description

@SHUBHANSHU602

Two core UI components contain branching logic and behavior that can fail silently, but currently do not have dedicated unit tests.
This creates a gap in regression safety for rendering, security, and conditional UI behavior.

Affected files (exact paths)

asyncapi-react/library/src/components/Markdown.tsx
asyncapi-react/library/src/components/Tag.tsx

Why tests are required

  1. Markdown.tsx

This component handles three distinct render paths and performs HTML injection after sanitization, which is security- and rendering-critical.

Image

Why this needs tests:
Multiple conditional branches (null, non-string, string)
Uses dangerouslySetInnerHTML
Depends on renderMarkdown + sanitize
A regression here would break docs rendering or introduce security risk without throwing errors

  1. Tag.tsx

This component conditionally changes the rendered DOM structure based on AsyncAPI parser data (externalDocs).

Image

Why this needs tests:

Two different render outputs (wrapped vs non-wrapped)
Depends on @asyncapi/parser interfaces
Easily breakable during refactors without visible runtime errors

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