test(marketplace): pin the agent detail page's load path - #743
Merged
Conversation
`AgentDetailPage` had no spec, which is the only reason the phase 3 bug (`load()` in the constructor, fixed in f60951b) reached users: the page rendered "Failed to load this agent." with no HTTP request behind it, and nothing in CI looked. Five tests over the load path. The two that would have caught it assert that `AgentApiService.getAgent` is called with the bound id, and that the error banner is absent on the happy path — deliberately not assertions about the rendered agent, since a zero-request page is what the bug actually produced.⚠️ The component is routed through `RouterTestingHarness` with `provideRouter(routes, withComponentInputBinding())` rather than constructed directly. That is load-bearing, not ceremony: `id` is an `input.required` the router sets *after* construction, so handing it in at construction time makes every assertion here pass against the broken code too. Verified both ways — red against the constructor form (`getAgent` called 0 times), green against the fix. Services are stubbed via DI tokens rather than `vi.mock`, per the repo convention on cross-spec mock pollution. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
Adds
agent-detail.page.spec.ts— the file whose absence let the phase 3 bug fixed in #740 reach users.AgentDetailPagehad no spec at all, so a page that rendered "Failed to load this agent." with no HTTP request behind it looked fine to CI.Five tests over the load path:
idThe two that would have caught the original bug assert that
AgentApiService.getAgentis called with the bound id, and that the banner is absent on the happy path — deliberately not assertions about the rendered agent, because a zero-request page is what the bug actually produced.The load-bearing part
RouterTestingHarnesswithprovideRouter(routes, withComponentInputBinding())rather than constructed directly. That is not ceremony:idis aninput.requiredthat the router sets after construction, so handing it in at construction time makes every assertion here pass against the broken code too.Verified both ways — red against the constructor form (
getAgentcalled 0 times), green against the fix.Please keep that shape if this spec is ever refactored; a
TestBed.createComponentwith inputs pre-supplied silently stops testing the thing that broke.Services are stubbed via DI tokens rather than
vi.mock, per the repo convention on cross-spec mock pollution.Verification
npm test(i.e.ng test— there is no standalone vitest config, so a barenpx vitest runfails wholesale and is not the right invocation):developwith fix(marketplace): the agent detail page never loaded its agent #740 mergedagents/agent-form/agent-form.page.spec.ts, which are unrelated and pre-existingDepends on
#740 (merged) — the
ngOnInitfix these tests pin.Deploy
None. Test-only; no runtime code touched.
🤖 Generated with Claude Code