test: add coverage for pagination cursor, leaderboard sort, wallet validator, and creator profile stats - #688
Merged
Chucks1093 merged 1 commit intoJul 28, 2026
Conversation
… order, wallet validator, and creator profile stats Closes accesslayerorg#678 Closes accesslayerorg#679 Closes accesslayerorg#680 Closes accesslayerorg#682
|
@Akpolo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
4 tasks
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.
Summary
Adds test coverage for four assigned Stellar Wave issues in one branch/PR, per each issue's acceptance criteria. Two issues (#680, #678) required a small, targeted production fix because the endpoint they describe didn't fully exist yet; one issue (#682) exposed a real validation bug. Each is called out below.
#679 — Pagination cursor encode/decode round-trip (
src/utils/test/cursor.utils.test.ts)typeof/toBechecks proving the type survives (not justtoEqual).CursorChecksumError— this codebase'sInvalidCursor-equivalent forencodeCursor/decodeCursor.CursorChecksumError.#680 — Leaderboard endpoint sorted by holder count (
src/modules/creators/creator-leaderboard-sort-order.integration.test.ts)trendingendpoint's test).rank,creator,holder_count, andcurrent_price.GET /api/v1/creators/leaderboarddid not exist at all. AddedhttpGetCreatorLeaderboard(creators.controllers.ts) and wired the route increators.routes.ts, computing holder count per creator, resolvingcreatorto the owning user's Stellar wallet address, and sorting by holder count desc / address asc.#682 — Stellar wallet address validator (
src/modules/wallet/__tests__/wallet.utils.test.ts)true; wrong prefix (M...muxed-style) →false; random string →false; empty string →false(already covered by existing tests, extended with a real muxed-account fixture for the M-prefix case).false— this exposed a real bug:isValidStellarAddressonly checked the surface shape (/^G[A-Z2-7]{55}$/) and never verified the StrKey checksum, so a well-formed-but-corrupted address passed validation. Fixed by delegating toStrKey.isValidEd25519PublicKeyfrom the already-installed@stellar/stellar-basedependency.GAAAA...) that only passed the old naive regex, this fix required swapping those fixtures for a real, checksum-valid address in:wallet-holdings-price-snapshot.integration.test.ts,wallet-holdings-zero-balance.integration.test.ts,wallet-holdings.service.integration.test.ts, andwallet-holdings-multiple-snapshots.integration.test.ts. No behavior in those files changed — only the fixture address.#678 — Creator profile key stats after a buy (
src/modules/creators/creator-stats-buy-transaction.integration.test.ts)totalSupply: 10,holderCount: 3.updateOwnershipplus a new price snapshot value; assertstotalSupply: 15,holderCount: 4, updatedcurrentPrice, and HTTP 200 — all three stats returned together.GET /api/v1/creators/:id/statshardcodedtotalSupply: 0instead of deriving it from the ownership read model, so it never reflected buys. Fixed to aggregatekeyOwnership.balancefor the creator. Also addedcurrentPrice(previously absent from this endpoint) sourced fromcreatorPriceSnapshot, since the acceptance criteria requires price to be returned alongside supply and holder count from the same response.Test plan