fix: technical debts left by the Sites, Authors and SEO slices, plus backend support for the new Sites and Authors pagination

This commit is contained in:
Florian Sylvain committed 2026-10-19 00:25:31 +02:00
1 parent 9f4ce426a8
commit daf3594316
86 files changed
+4223 -1485

No files matched your search

+73
View File
@@ -189,3 +189,76 @@ Feature: Paginated article listing
Given the repository fails on its next call
When a client sends GET /v1/article/
Then the status is 500 and the body is "Failed to retrieve articles"
Rule: counts.suggestions
Background:
Given counts holds all, online, draft and suggestions, and the rest of the body shape ({"items","total","page","size","counts"}) is unchanged
And suggestions is the number of visible articles whose seo_status is "suggestions"
And it ignores q, status, site, seo, sort, page and size, like the other counts
And an article whose seo_status is "hidden" or "ready" is not counted
And a suggestion code listed in the article's seo_dismissed is never counted
And it equals the total of GET /v1/article/?seo=suggestions sent with no other filter by the same caller
Scenario: counts carries the suggestions count
Given 4 online and 2 draft articles of which 3 have suggestions
When a verified account sends GET /v1/article/
Then counts is {"all": 6, "online": 4, "draft": 2, "suggestions": 3}
Scenario: It is zero when nothing needs attention
Given 5 articles that all have a clean SEO check
When a verified account sends GET /v1/article/
Then counts.suggestions is 0
Scenario: It equals the total of the suggestions filter
Given 30 articles of which 12 have suggestions
When a verified account sends GET /v1/article/?seo=suggestions
Then total is 12 and counts.suggestions is 12
Scenario Outline: It ignores every other query parameter
Given 6 articles of which 3 have suggestions, on the sites "renew" and "journal"
When a verified account sends GET /v1/article/?<params>
Then counts.suggestions is 3
Examples:
| params |
| q=tile |
| status=draft |
| site=journal |
| seo=ready |
| seo=hidden |
| sort=title:asc |
| size=5&page=99 |
Scenario: Hidden articles are not counted
Given an article with suggestions that is noindex
When a verified account sends GET /v1/article/
Then counts.suggestions is 0
Scenario: Dismissed suggestions are not counted
Given an article whose only suggestion is dismissed
When a verified account sends GET /v1/article/
Then counts.suggestions is 0
Scenario: A verified caller counts offline articles too
Given an online and a draft article, both with suggestions
When a verified account sends GET /v1/article/
Then counts.suggestions is 2
Scenario: A public caller counts online articles only
Given an online and an offline article, both with suggestions
When a caller without a verified account sends GET /v1/article/
Then counts is {"all": 1, "online": 1, "draft": 0, "suggestions": 1}
Scenario: An empty library
When a verified account sends GET /v1/article/ with no article stored
Then counts is {"all": 0, "online": 0, "draft": 0, "suggestions": 0}
Scenario: A failure to compute the count fails the request
Given the repository fails while the suggestions are evaluated
When a verified account sends GET /v1/article/
Then the status is 500 and the body is "Failed to retrieve articles"
Scenario: Existing fields are unchanged
Then total, page, size, ordering and every item field are as before
And counts.all, counts.online and counts.draft keep their values