This repository was archived by the owner on May 9, 2026. It is now read-only.
test(renderer): coverage audit (priority 7)#138
Merged
Conversation
9be6c3a to
c09211e
Compare
Adds 23 tests in a single new file (src/edge-cases.test.ts), no production-code changes. Targets the corners of the @clearcms/renderer public surface that the shipped src/index.test.ts doesn't pin: renderBlocks edge cases (6 tests): - empty manifest in / empty manifest out - order preservation across a 50-block manifest - registry value type-agnosticism (string, number, function, object) — locked because the package is framework-neutral - props reference passthrough (memo-friendly for downstream adapters) - schemaVersion preserved on descriptor.meta when present - two unknown blocks of the same type stay independent (no aliasing) UnknownBlock (3 tests): - fresh object each call (no shared state) - props reference passthrough - kind=\"unknown\" discriminator is stable usePreview URL parsing (7 tests): - clear-preview detected when surrounded by other params - empty value / valueless key still count - hash-fragment-only \"clear-preview\" does NOT trigger - relative URL strings work via synthesized base - query-only string (no path) works - similar-named params (clear-preview-debug, xclear-preview) excluded - empty string returns previewing=false usePreview.markField (7 tests): - empty fieldPath returns the whole record - numeric segments resolve through array index lookup - primitive ancestors (string/number/boolean) return undefined - null ancestor returns undefined - non-object input record returns undefined - __proto__ named keys read literally (own properties only) - dataClearField only emitted when previewing (production markup byte-identical to no-preview path) Bug found and filed (NOT fixed here): - #135 — packages/renderer/package.json files array does not exclude *.test.ts → tests currently ship in the npm tarball. Mirrors the SDK convention. Pure manifest fix; out of scope for this audit branch. Verification: - pnpm --filter @clearcms/renderer test → 32 passed (was 9) - pnpm --filter @clearcms/renderer typecheck → clean No new dependencies. No production code touched. No changeset. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8d06684 to
b4bd12d
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Non-PLAN quality work — priority 7 from the lead's task list. Independent of the v1 sequence.
Summary
9 → 32 tests (+23) in 1 new file
packages/renderer/src/edge-cases.test.ts.Coverage gaps closed
schemaVersionmeta preservationUnknownBlockno shared state across instancesmarkField(empty path, numeric/array indices, primitive/null/non-object ancestors,__proto__literal-read safety, preview-onlydataClearField)Related
Filed #135 — pre-existing bug:
packages/renderer/package.jsonfilesarray doesn't exclude*.test.ts. Out of scope for this PR (audit rule: don't fix bugs while testing).Verification
pnpm --filter @clearcms/renderer test— 32/32 passpnpm --filter @clearcms/renderer typecheck— cleanpackages/renderer/src/edge-cases.test.ts)🤖 Generated with Claude Code