Page MenuHomePhabricator

tests: Expand 'ext.readingLists.api/index.js' coverage
Closed, ResolvedPublic1 Estimated Story Points

Description

Background

The JS API module ('ext.readingLists.api/index.js') has test coverage gaps. Several code paths were never exercised by the Jest suite -- things like what happens when the MediaWiki API doesn't return normalized or redirects in its response, the title-normalization-then-redirect lookup chain, and most of the toBase64/fromBase64 functions.

Goal

Add the missing tests so that the branch coverage for this file goes up and CI can catch regressions in those paths.

Acceptance Criteria for done

  • Branch coverage for ext.readingLists.api/index.js increases
  • Test for getPagesFromManifest where the API response has no normalized or redirects fields
  • Test for getPagesFromManifest where a title gets normalized and then redirected before being matched to a page
  • Test for fromBase64 where the encoded data already has a name set and covering basic encoding, non-Latin-1 input, and a round-trip back through fromBase64
  • All existing tests still pass

Event Timeline

Change #1275159 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/ReadingLists@master] tests: Expand 'ext.readingLists.api/index.js' coverage

https://gerrit.wikimedia.org/r/1275159

Change #1275159 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] tests: Expand 'ext.readingLists.api/index.js' coverage

https://gerrit.wikimedia.org/r/1275159

Volker_E updated the task description. (Show Details)
Volker_E updated the task description. (Show Details)