Skip to content

Add tests for the React OpenUI Lang renderer #549

@vishxrad

Description

@vishxrad

Summary

@openuidev/react-lang has a test script, but it currently fails because there are no test files in the package. The Vue and Svelte renderers already have small renderer test suites that can be used as a template.

Current behavior

Running:

pnpm --filter @openuidev/react-lang test

exits with:

No test files found, exiting with code 1

Suggested implementation

Add a focused Vitest test suite for the React Renderer covering the same basics already covered by Vue/Svelte:

  • renders without crashing when response is null
  • renders without crashing when response is an empty string
  • calls onParseResult(null) for a null response
  • calls onParseResult with a parse result for valid OpenUI Lang
  • confirms the parsed root component typeName
  • accepts/defaults isStreaming

Useful references:

  • packages/react-lang/src/Renderer.tsx
  • packages/vue-lang/src/__tests__/Renderer.test.ts
  • packages/svelte-lang/src/__tests__/Renderer.test.ts

Acceptance criteria

  • packages/react-lang includes renderer tests.
  • pnpm --filter @openuidev/react-lang test passes.
  • The tests follow the local style used by the Vue/Svelte renderer tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions