Skip to content

test(router): targeted tests for data-context and i18n (#275)#372

Merged
SisyphusZheng merged 1 commit into
devfrom
fix/275-targeted-tests
Jul 9, 2026
Merged

test(router): targeted tests for data-context and i18n (#275)#372
SisyphusZheng merged 1 commit into
devfrom
fix/275-targeted-tests

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

Summary

#275 asked for targeted tests across protocol, ui, element, and router.

On inspection, protocol (errors, hydration-markers, render, vnode),
ui (components/css-smoke/smoke/static-subpath), and element (5 test files,
including the runtime-module coverage added for #328) already ship test files.
The gap was router's runtime surface: data-context.ts and i18n.ts had no
tests.

  • data-context.test.ts (7 tests): render-scoped loader/action data stack —
    push/pop/peek contract, action-data association to the top frame, nested render
    scoping, empty-stack behavior, and the depth>10 warning guard.
  • i18n.test.ts (6 tests): normalizeLocalePath — locale-prefix detection,
    default-locale fallback, localized-path construction, root path, and empty
    locales list.

Both modules are DOM-free pure logic, so no production code changed and no DOM
shim is required.

Test plan

  • deno test on both new files: 13 passed.
  • deno fmt --check + deno lint clean.
  • No production code touched.

Closes #275

#275 asks for targeted tests across protocol, ui, element, and router.
protocol/ui/element already ship test files; router's runtime surface had
two untested pure modules:

- data-context.test.ts: render-scoped loader/action data stack — push/pop/peek
  contract, action-data association to the top frame, nested render scoping,
  empty-stack behavior, and the depth>10 warning guard.
- i18n.test.ts: normalizeLocalePath — locale-prefix detection, default-locale
  fallback, localized-path construction, root path, and empty-locales list.

Both are DOM-free; no production code changed.

Closes #275
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying openelement with  Cloudflare Pages  Cloudflare Pages

Latest commit: d7d3c2d
Status: ✅  Deploy successful!
Preview URL: https://168d5973.lessjs.pages.dev
Branch Preview URL: https://fix-275-targeted-tests.lessjs.pages.dev

View logs

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@SisyphusZheng SisyphusZheng merged commit a089c1f into dev Jul 9, 2026
4 of 5 checks passed
@SisyphusZheng SisyphusZheng deleted the fix/275-targeted-tests branch July 9, 2026 09:09
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.

1 participant