test(web): harden feed conversion retry and race scenarios#918
test(web): harden feed conversion retry and race scenarios#918gildesmarais merged 5 commits intomainfrom
Conversation
(cherry picked from commit 4bbe6d1)
There was a problem hiding this comment.
Pull request overview
Ports and expands test coverage for feed conversion retry/race behavior across the web API and frontend hook logic, while cleaning up an unneeded frontend dependency related to OpenAPI client generation.
Changes:
- Adjust API spec expectations around URL normalization for feed creation.
- Add frontend hook tests covering unauthorized failure (no auto-retry) and stale preview update race handling.
- Remove
@hey-api/client-fetchfrom frontend dependencies and update lockfile accordingly.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| spec/html2rss/web/api/v1_spec.rb | Updates the URL normalization spec assertion approach. |
| frontend/src/tests/useFeedConversion.test.ts | Adds tests for unauthorized non-retry behavior and stale preview race handling. |
| frontend/package.json | Drops @hey-api/client-fetch from dependencies. |
| frontend/package-lock.json | Removes @hey-api/client-fetch and reclassifies related packages as dev deps per lockfile updates. |
Files not reviewed (1)
- frontend/package-lock.json: Language not supported
| it 'normalizes hostname-only input to https before feed creation', :aggregate_failures do | ||
| allow(Html2rss::Web::AutoSource).to receive(:create_stable_feed).and_call_original | ||
|
|
||
| post_feed_request(url: 'example.com/articles', strategy: 'faraday') | ||
|
|
||
| expect(Html2rss::Web::AutoSource).to have_received(:create_stable_feed).with( | ||
| anything, | ||
| 'https://example.com/articles', | ||
| kind_of(Hash), | ||
| 'faraday' | ||
| ) | ||
|
|
||
| expect(last_response.status).to eq(201) | ||
| json = expect_success_response(last_response) | ||
| expect(json.dig('data', 'feed', 'url')).to eq('https://example.com/articles') |
There was a problem hiding this comment.
This example no longer asserts behavior "before feed creation" (the previous spy on AutoSource.create_stable_feed was removed), so the spec now only verifies the response payload. Either update the example description to reflect what’s actually asserted, or add a black-box assertion that proves the submitted URL was normalized prior to persistence (e.g., by checking the created feed record/token mapping).
Summary
Validation