Skip to content

chore: increase test coverage #638

Merged
bmc08gt merged 16 commits intocode/cashfrom
chore/test-coverage
Apr 6, 2026
Merged

chore: increase test coverage #638
bmc08gt merged 16 commits intocode/cashfrom
chore/test-coverage

Conversation

@bmc08gt
Copy link
Copy Markdown
Collaborator

@bmc08gt bmc08gt commented Apr 6, 2026

No description provided.

bmc08gt added 16 commits April 3, 2026 22:21
Fix failing ExternalWalletDeeplinkStateErrorTest by replacing tryEmit()
with suspending emit() on unbuffered MutableSharedFlow. Add ~117 new
unit tests covering ShortVec, AgoraMemo, MessageHeader, AccountMeta,
Instruction, program addresses, PublicKey, Key32, Mint,
CachePolicyHandler, Loadable, and Result/List extensions.

Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
…nd utils

- Base58: encode/decode roundtrips, leading zeros, checked encoding, invalid chars
- DerivePath: path parsing, predefined paths, password handling
- MnemonicPhrase: word count validation for 12/24 words
- Extensions: byte array conversions, hex encoding, URL encode/decode, replaceParam
Covers canConsume, consume, prefix, suffix, chunk, byteToUnsignedInt, and ByteArray.toLong.
…nd utilities

- Fiat: construction, arithmetic, comparison, rounding, currency conversion
- VersionedMessageV0: encoding structure, determinism, size validation
- CompiledInstruction: encode/fromList roundtrip, compile/decompile roundtrip
- CurrencyCode: fractionDigits for all 8 special-cased currencies
- Result extensions: filter and filterIsInstance
- Double/String utils: roundTo, toLocaleAwareDoubleOrNull, padded
- ProgramAddresses, SysVar, SodiumError, SwapMetadata
Covers LoginError, RegisterError, EmailVerificationError, PhoneVerificationError, PlacePoolBetError, and GetJwtError.
…nce, and userflags

- FormatUtils: round, format, formatWholeRoundDown, formatCurrency
- Number: abbreviated() K/M/B/T suffixes
- AggregationType: LTTB downsample and Bucketed aggregation types
- DeeplinkError: fromCode mapping and enum coverage
- TokenTypeConverters: JSON roundtrips for SocialLinks, BillCustomizations, HolderMetrics
- ResolvedFlag/FieldOverride: effectiveValue and override logic
These tests use Robolectric to handle android.util.Base64 and
android.text.format.DateFormat dependencies that cannot run as
pure JVM tests.

- Base64ExtensionsTest: encode/decode roundtrips, URL-safe, base58
- SerializerTest: ByteList and PublicKey JSON serialization roundtrips
- DateUtilsTest: date formatting and Instant conversion
…on tests

- ActivityFeedMessageTest: MessageState.from() parsing with fallback
  and MessageMetadata.from() JSON deserialization
- DeeplinkFragmentsTest: Uri.fragments extension for deeplink parsing
  (Robolectric for android.net.Uri)
- InstantExtensionsTest: toLocalDate, atStartOfDay, atEndOfDay,
  format, formatLocalized
- ShortVecTest: encode/decode roundtrips, boundary values, encodeList
- UInt16Test: little-endian encoding for 0, 255, 256, 65535
- MapsTest: getOrPutIfNonNull conditional insertion
- LongTest: floored millisecond-to-second truncation
- ByteArrayExtensionsTest: toPublicKey, toMint, toSignature, toHash
- MessageTest: encode/decode roundtrip, header construction from
  accounts, account sorting (signers before non-signers, writable
  before readonly), multiple instructions
- ComputeBudgetProgramTest: SetComputeUnitPrice and SetComputeUnitLimit
  encode/decode roundtrips, encoding format validation
…tests

- VirtualMachineProgramTest: TransferForSwap and CloseSwapAccountIfEmpty
  encoding, account counts, signer flags, command bytes
- CurrencyCreatorProgramTest: BuyAndDepositIntoVm and SellAndDepositIntoVm
  encoding, account counts, U16 vmMemoryIndex encoding, command bytes
The native Ed25519 JNI library crashes during JVM test execution due to
System.loadLibrary in the static initializer. This shadow class, backed
by net.i2p.crypto:eddsa, provides identical Ed25519 operations (key gen,
sign, verify, onCurve) without native dependencies.

Modules opt in via srcDir pointing to testing/ed25519-shadow, which
compiles the shadow into test classes (highest classpath priority).
Using the Ed25519 shadow, these tests cover previously-blocked crypto
paths: transaction construction, signing, verification, encode/decode
roundtrips, and all PDA derivation functions (associated accounts,
VM accounts, deposit, timelock, swap, omnibus).
- CoinbaseOnRampEventHandler: 15 tests covering event routing (success,
  cancel, auto-click, all 4 error event types), unknown/invalid JSON
- CoinbaseOnRampWebError: 3 tests for tryValueOf parsing
- SubmitIntentError.typed(): 11 tests for proto→error mapping with
  reason string extraction from ErrorDetails
- SwapError.typed(): 8 tests for proto→error mapping with deny/reason
  extraction
Consolidates the repeated test sourceSet + eddsa dependency into
a single `flipcash.android.ed25519.shadow` convention plugin.
@bmc08gt bmc08gt self-assigned this Apr 6, 2026
@bmc08gt bmc08gt merged commit 342c694 into code/cash Apr 6, 2026
1 check passed
@bmc08gt bmc08gt deleted the chore/test-coverage branch April 6, 2026 15:10
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