test: complete unit test coverage of typed Spot REST operations - #107
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds unit tests for the 21 typed operations that had none, so all 76 Spot REST operations tracked in #82 are now covered by a test of request encoding and response mapping against a Kraken fixture.
Tests
Time,SystemStatus,Assets,AssetPairsandTickerget endpoint tests (URL and query parameters, fixture decoding, lookup by name and alternate name, fee tiers, restricted asset statuses, unknown enum values) and routing tests inMarketDataTest.Ledgers,QueryLedgers,AddExport,ExportStatus,RetrieveExportandRemoveExportget endpoint tests and routing tests inKrakenAPIAccountTest. Ledger tests cover date bounds taking precedence over ledger identifiers, paging withwithNextResultOffset(), entry identifiers carried byasList(), staking reward filtering and full pages.RetrieveExportis tested on an in-memory ZIP archive holding a ledger CSV, both throughprocessZipResponseand throughDefaultKrakenRestRequesterwith anapplication/zipresponse.CreateSubaccountandAccountTransfer, with routing tests in the newKrakenAPISubaccountTest.lock_type[n]parameters, bonded strategies with their periods asDuration, allocations in every state with a payout period, and pending statuses, with routing tests in the newKrakenAPIEarnTest.PreTradeandPostTrade, including nanosecond timestamps reused as the nextfrom_ts, with routing tests in the newKrakenAPITransparencyTest.Fixtures are the response examples of the OpenAPI spec
1.1.0, retrieved on 2026-09-21.PreTradeandPostTradehave no documented example, so their fixtures are assembled from the property examples of the response schemas. Each fixture directory has a README describing its sources and supplemental inline cases. The library suite goes from 453 to 589 tests.Fixes found by the tests
Report.subTypewas alwaysnull: Kraken sendssubtype, and the component had no@JsonProperty.SystemStatus.DescriptionandReport.Statuswere package-private although returned by public record accessors, so callers could not comparestatus()against a constant. Both are now public and documented.Not covered here
These gaps showed up while checking the spec and are left for follow-ups:
SystemStatusrecord ignores theupcoming_maintenanceandemergencyarrays the endpoint now returns.LedgerInfoParamsandLedgerEntriesParamsdon't expose therebase_multiplierparameter ofLedgersandQueryLedgers.PostTradeParamsrequires a symbol, while the spec makes it optional and returns the last 1000 trades of all pairs without one.RetrieveExportasapplication/octet-stream, whileDefaultKrakenRestRequesteronly reads archives served asapplication/zip.Validation
mvnd -B clean packagepasses with 589 tests, andjavadoc:jarwith the release profile'sdoclintsettings passes on the two changed records. No test calls the Kraken API or needs API keys.