[readthedocs] Move to readthedocs API v3#11995
Conversation
|
| const build = results.find(({ state }) => state.code === 'finished') | ||
| if (!build) { | ||
| throw new NotFound({ | ||
| prettyMessage: 'project or version not found', |
There was a problem hiding this comment.
When a project or version is not found, won't it return a 404, as per line 86? Perhaps this message should say something along the lines of no finished builds?
There was a problem hiding this comment.
Good point. A 404 is already handled separately, so an empty results array specifically means there are no finished builds. I’ll change the message to no finished builds.
| .intercept(nock => | ||
| nock(apiBaseUrl) | ||
| .get('/api/v3/projects/this-repo/versions/does-not-exist/builds/') | ||
| .query(buildsQuery) | ||
| .reply(404), | ||
| ) |
There was a problem hiding this comment.
Let's make this test non-mocked as well, to exercise the 404 path properly.
There was a problem hiding this comment.
I checked the live API, but the builds endpoint returns 200 with an empty results array for both unknown projects and unknown versions, so making this test non-mocked would not exercise the 404 path. I’ll change the empty-results message to no finished builds. Would you prefer that we remove the unused 404 mapping and make the unknown-project test live, or keep the mocked test to cover a potential 404 response?
Fixes #11952