Skip to content

Add unit tests for the React OpenUI Lang renderer#608

Open
a2Fsa2k wants to merge 4 commits into
thesysdev:mainfrom
a2Fsa2k:feat/react-lang-tests
Open

Add unit tests for the React OpenUI Lang renderer#608
a2Fsa2k wants to merge 4 commits into
thesysdev:mainfrom
a2Fsa2k:feat/react-lang-tests

Conversation

@a2Fsa2k

@a2Fsa2k a2Fsa2k commented Jun 5, 2026

Copy link
Copy Markdown

Summary

Adds a Vitest test suite for the React Renderer component in packages/react-lang, mirroring the existing test coverage in the Vue and Svelte renderer packages.

Test coverage

  • 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

Changes

  • packages/react-lang/vitest.config.ts — new vitest config with jsdom environment
  • packages/react-lang/src/__tests__/Renderer.test.tsx — new test file with 7 tests
  • packages/react-lang/package.json — added @testing-library/react and jsdom devDependencies
  • pnpm-lock.yaml — updated lockfile

Closes #549

a2Fsa2k added 4 commits June 5, 2026 16:10
Adds a Vitest test suite for the React Renderer component, mirroring the
existing tests in the Vue and Svelte packages. Covers null/empty response
handling, onParseResult callbacks, parsing correctness, and isStreaming
prop defaults.

Closes thesysdev#549
Adds a `createStrictParser()` that reports unexpected text as
parse-failed errors instead of silently skipping it. Useful for
debugging when LLMs generate preamble text alongside valid
openui-lang statements.

Changes:
- Add `tokenText()` utility to reconstruct text from tokens
- `split()` now collects skipped line text when a collector is provided
- Add `createStrictParser()` and `strict` parameter to `parse()`
- Add "parse-failed" to ValidationErrorCode
- Add test coverage for strict mode

Closes thesysdev#582
# Conflicts:
#	packages/lang-core/src/parser/__tests__/parser.test.ts
#	pnpm-lock.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for the React OpenUI Lang renderer

1 participant