CodeRabbit Generated Unit Tests: Add unit tests#406
Merged
phillipc merged 4 commits intoJun 7, 2026
Merged
Conversation
Bumps the dev-dependencies group with 1 update: [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip). Updates `knip` from 6.14.2 to 6.15.0 - [Release notes](https://github.com/webpro-nl/knip/releases) - [Commits](https://github.com/webpro-nl/knip/commits/knip@6.15.0/packages/knip) --- updated-dependencies: - dependency-name: knip dependency-version: 6.15.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
…-2b861466cc chore(deps-dev): bump knip from 6.14.2 to 6.15.0 in the dev-dependencies group
Contributor
Author
|
Important Review skippedThis PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
|
||
| describe('render()', () => { | ||
| it('returns an object with a node and dispose function', () => { | ||
| const result = render({ elementName: 'div', children: [], attributes: {} }) |
| }) | ||
|
|
||
| it('returns the single child node when jsx produces exactly one element', () => { | ||
| const result = render({ elementName: 'span', children: [], attributes: { id: 'test' } }) |
| }) | ||
|
|
||
| it('returns the single text node when jsx is a plain string', () => { | ||
| const result = render('hello world') |
| // An observable with a string value renders a text node + a comment (<!--O-->), | ||
| // which is two child nodes inside the fragment, so render() returns the fragment. | ||
| const obs = observable('a') | ||
| const result = render(obs) |
| }) | ||
|
|
||
| it('returns a DocumentFragment when jsx is an array of multiple items', () => { | ||
| const result = render(['first', 'second']) |
| }) | ||
|
|
||
| it('dispose() can be called without throwing', () => { | ||
| const result = render({ elementName: 'div', children: ['text'], attributes: {} }) |
| it('returns null node when jsx produces no children (empty array)', () => { | ||
| // An empty array inserts nothing — fragment stays empty, so firstChild is null. | ||
| // fragment.childNodes.length === 0 → falls to the fragment branch (length !== 1) | ||
| const result = render([]) |
| }) | ||
|
|
||
| it('node property reflects the rendered element tag name', () => { | ||
| const result = render({ elementName: 'article', children: ['content'], attributes: { class: 'main' } }) |
|
|
||
| it('dispose() tears down the observer so observable updates no longer apply', () => { | ||
| const obs = observable({ elementName: 'p', children: ['initial'], attributes: {} }) | ||
| const result = render(obs) |
…heck-ci' into coderabbitai/utg/8733691
7c1e6c5
into
403-add-published-type-checks-attw-publint-to-publish-check-ci
8 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unit test generation was requested by @phillipc.
The following files were modified:
packages/builder/spec/builderBehaviors.tspackages/utils.jsx/spec/jsxBehaviors.ts