Skip to content

test: add Stellar config validation property tests (Property 9)#1

Open
Markodiba wants to merge 1 commit into
mainfrom
issue-048-add-property-test-for-stellar-configuration-vali
Open

test: add Stellar config validation property tests (Property 9)#1
Markodiba wants to merge 1 commit into
mainfrom
issue-048-add-property-test-for-stellar-configuration-vali

Conversation

@Markodiba
Copy link
Copy Markdown
Owner

Summary

Implements Property 9 — Stellar Configuration Validation property tests using fast-check.

Changes

  • apps/web/src/lib/customization/validate-stellar.property.test.ts — 9 property tests across 3 groups, 100 iterations each

Properties tested

Valid configurations always pass

  • Any network + matching horizon URL
  • With optional soroban RPC URL
  • With asset pairs (correct AssetPair shape)
  • With contract addresses
  • All combined

Invalid configurations always fail with specific errors

  • Mismatched horizon URL → HORIZON_NETWORK_MISMATCH on stellar.horizonUrl
  • Non-URL horizon → schema error on stellar.horizonUrl
  • Non-URL soroban RPC → schema error on stellar.sorobanRpcUrl
  • Invalid network enum → schema error on stellar.network

Structural invariants

  • result.valid and result.errors are always consistent
  • Every error always carries field, message, and code
  • Asset pairs and contracts do not mask network mismatch detection

Notes

  • Arbitraries use correct domain types (StellarAsset, AssetPair) from @craft/types
  • Base config uses fixed distinct colors to isolate Stellar-specific failures from DUPLICATE_COLORS

Closes StellerCraft#48

Generate network, asset pair, and contract address combinations via
fast-check arbitraries. Run 100 iterations per property asserting:
- valid combinations (network + horizon, + soroban RPC, + asset pairs,
  + contracts, all combined) always pass with no errors
- mismatched horizon URL always fails with HORIZON_NETWORK_MISMATCH
- non-URL horizon/soroban RPC always fails with field-level schema errors
- invalid network enum always fails with stellar.network error
- result.valid and result.errors are always structurally consistent
- every error always carries field, message, and code

Closes StellerCraft#48
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.

Issue 048: Add property test for Stellar configuration validation

1 participant