Skip to content

Add unit tests for mod endpoints - #17

Merged
pavog merged 3 commits into
masterfrom
add-mod-tests
Oct 16, 2026
Merged

pavog merged 3 commits into
masterfrom
add-mod-tests

Conversation

@pavog

@pavog pavog commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

This PR adds unit tests for the mod endpoints of CurseForgeAPIClient. They run against the mocked HTTP client from ClientTestCase.

searchMods()

  • A search for “mclogs” with pagination, with the results mapped to Mod
  • All options are set and every query parameter is checked. categoryIds, gameVersions and modLoaderTypes are sent as JSON arrays, and clientCompatible as true (see Fix boolean query parameters #14).
  • The page size is capped at 50, and at 10 when the offset is 9990, so the request stays within the API’s 10,000-result limit.

getMod()

  • getMods(): once with default values, once with devModIds and filterPcOnly
  • getFeaturedMods(): once with default values, once with excludedModIds, gameVersionTypeId and clientCompatible
  • getModDescription(): once without lang, once with it

also

ClientTestCase gets a new helper, assertPostRequest(), which checks the method, the path and the JSON body of a request. The tests record the current behaviour that null values are sent explicitly in the body, for example "filterPcOnly": null.

The fixtures are recorded responses from the real CurseForge API. To keep them small, latestFiles and latestFilesIndexes are cut down to a few entries per mod.

@pavog
pavog merged commit 3ef638a into master Oct 16, 2026
5 checks passed
@pavog
pavog deleted the add-mod-tests branch October 16, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant