tests: raise wallet coverage from 77.7% to 84.4%#1
Merged
Conversation
Add targeted tests for paywall send/recv hooks, sqlite issued/settled lookups, dispatcher decode paths, EVM accessors, and validation branches in Wallet.Request / Wallet.Topup. All tests use t.TempDir() for file-based state and never log private key material. Per-package coverage: pkg/wallet 74.1% -> 85.5% pkg/walletipc 82.1% -> 86.2% pkg/evm 82.4% -> 84.1% cmd/wallet 76.3% -> 76.3%
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
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
pkg/wallet,pkg/walletipc,pkg/evm, andcmd/wallet.*_test.gofiles.Per-package gains
pkg/walletpkg/walletipcpkg/evmcmd/walletWhat's covered now
Wallet.HookPreSendMessage(paywall happy path + every error branch: missing peer, bad base64 data, bad spec, blank spec, no-paywall passthrough, custom method/escrow IDs).Wallet.HookPostRecvMessage(no-data, bad-base64, bad-json, incomplete-envelope passthroughs + happy-path roundtrip with the sender's pre-send output).Wallet.RequestandWallet.Topupvalidation branches (zero amount, empty asset, missing source / expiresIn).sqliteStore.GetIssuedandsqliteStore.IsSettled(previously 0% — only the memory store had tests).walletipcdispatcher: historySince/Beforetime-bounds, empty-payload decode, type-mismatched JSON,ExpiresInSeconds=0rejection.evm.EVMMethodaccessors (ID,ChainID,Token,Address),Client.Endpoint,NewClient(_, nil)default-http branch, andUint128packing.Safety
t.TempDir()— nothing touches~/.pilot.t.Logf/fmt.Printlnof any private-key bytes (seed, signature, or otherwise) in any new test file.Test plan
go test -race -count=1 -timeout 120s ./...— all passgo vet ./...— cleango test -coverprofile=/tmp/wallet-after.cov -count=1 ./...thengo tool cover -func=... | tail -1— confirms 84.4%