Skip to content

Fill the nested-route gaps in the strict-resolver scenario#21333

Merged
NullVoxPopuli merged 2 commits intoemberjs:nvp/strict-resolver-rfc-1132from
NullVoxPopuli-ai-agent:nested-route-coverage
Apr 21, 2026
Merged

Fill the nested-route gaps in the strict-resolver scenario#21333
NullVoxPopuli merged 2 commits intoemberjs:nvp/strict-resolver-rfc-1132from
NullVoxPopuli-ai-agent:nested-route-coverage

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown
Contributor

Summary

Stacked on #21332 (trim-redundant-resolver-tests-2). The existing strict-resolver smoke test exercises a two-level nested route via /posts/42, but only asserts the child template rendered. Three concrete gaps:

  1. Parent template isn't asserted to render alongside the child. A regression where posts.hbs's {{outlet}} stopped propagating @model or the parent route stopped activating would pass today.
  2. No templates/posts/index.hbs, so we don't prove the resolver walks template:posts.indextemplates/posts/index (the name.index → name/index nested-folder path).
  3. No 3-level nesting coverage, so a regression in the type:a.b.c → a/b/c normalization path would slip through.

Changes

  • Add this.route('comments') under posts.show in the router, plus routes/posts/show/comments.js and templates/posts/show/comments.hbs. Give posts/show.hbs a {{outlet}} so the grandchild has somewhere to render.
  • Add templates/posts/index.hbs so the posts.index template path is actually resolvable.
  • Promote the two existing sub-route tests to also assert the parent template is in the DOM.
  • New test: three-level nested route resolves every level — visits /posts/42/comments and checks all three levels ([data-test="posts"], [data-test="post-detail"], [data-test="post-comments"] li) are in the DOM.

No resolver changes. One file changed (smoke-tests/scenarios/strict-resolver-test.ts, +57/−3).

Test plan

  • pnpm test --filter strict passes all three scenarios (strictResolver-basics, strictResolver-strict-resolver, strictResolver-strict-resolver-substates)
  • pnpm type-check:internals, pnpm prettier --check clean
  • CI

🤖 Generated with Claude Code

NullVoxPopuli and others added 2 commits April 21, 2026 11:35
After the basic-test.js cleanup, three cross-file overlaps remain.
None change coverage — each dropped case is already asserted by
another test.

registry_test.ts:
  - `resolves shorthand modules (without default wrapper)` is already
    covered by basic-test's three shorthand-edge-case tests, and the
    Application integration is already proven by `resolves modules
    provided via modules property` just above it.
  - `resolves router:main via ./router module` just re-checks the
    mainLookup path that basic-test covers via `\`type:main\` resolves
    to the unpluralized \`type\` module key`; router:main is
    registered by Ember itself, not by the strict resolver.

strict-resolver-test.ts:
  - `gjs component resolves from modules` and `sub-route with nested
    model` both visit `/posts` and inspect `[data-test=post-card]`.
    Folded the h2-exists assertion into the count test and dropped
    the standalone gjs test.

strict-resolver-substates-test.ts:
  - `visiting /posts renders the list` and `visiting a nested dynamic
    sub-route renders the detail template` repeat what
    strict-resolver-test.ts already checks; the substates scenario
    should focus on loading/error state behaviour.
  - Removed the now-unused posts/show scaffolding (router entry,
    routes/posts.js, routes/posts/show.js, templates/posts.hbs,
    templates/posts/show.hbs) to keep the scenario app minimal.

Net: −85 lines across three files, no loss of coverage. All three
strict-resolver smoke scenarios still pass locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The existing tests exercise a two-level nested route (`posts.show`
via `/posts/42`) but only assert the child template renders. Three
concrete gaps:

  1. The parent template isn't asserted to render alongside the
     child — a bug where the parent's `{{outlet}}` silently broke
     would pass.
  2. There's no `templates/posts/index.hbs`, so we don't prove the
     resolver can walk `template:posts.index` ->
     `templates/posts/index` (the `name.index -> name/index` nested
     folder path).
  3. No 3-level nesting coverage, so a regression in the
     `type:a.b.c -> a/b/c` normalization wouldn't be caught.

Changes:

  - Add `this.route('comments')` under `posts.show` and the matching
    `routes/posts/show/comments.js` + `templates/posts/show/comments.hbs`.
    Give `posts/show.hbs` a `{{outlet}}` so the grandchild has
    somewhere to render.
  - Add a `templates/posts/index.hbs`.
  - Promote the two sub-route tests to also check that the parent
    template is still in the DOM (post-cards + `[data-test="posts"]`).
  - Add a new "three-level nested route resolves every level" test
    that visits `/posts/42/comments` and asserts all three templates
    (posts.hbs, posts/show.hbs, posts/show/comments.hbs) resolved
    and rendered.

No resolver changes. All three strict-resolver smoke scenarios still
pass locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli merged commit 8bdd546 into emberjs:nvp/strict-resolver-rfc-1132 Apr 21, 2026
41 checks passed
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.

2 participants