Skip to content

test(chain): add unit tests for ToHTTPURL and DropsToXRP#30

Open
Sanka-D wants to merge 1 commit into
mainfrom
test/go-unit-tests
Open

test(chain): add unit tests for ToHTTPURL and DropsToXRP#30
Sanka-D wants to merge 1 commit into
mainfrom
test/go-unit-tests

Conversation

@Sanka-D

@Sanka-D Sanka-D commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

pkg/chain was the remaining pure-logic package with no unit tests. This adds pkg/chain/client_test.go covering its two pure helpers.

Tests

  • ToHTTPURL — the WS→HTTP(S) conversion used to talk JSON-RPC:
    • ws://http://, wss://https://
    • local-dev remap of WS port 6006 → JSON-RPC port 5005
    • edge cases: non-6006 ports and non-localhost hosts are left untouched; wss does not remap ports
    • NewClient(...) wires the remapped URL onto the client
  • DropsToXRP — drops→XRP formatting, incl. sub-XRP amounts and unparseable input (→ zero)

Notes

Complements the existing suite (pkg/abi, pkg/config, pkg/primitives, pkg/wallet). go test ./... and go vet ./... pass.

🤖 Generated with Claude Code

pkg/chain had no tests. Cover the two pure helpers:

- ToHTTPURL: ws→http / wss→https, and the local-dev remap of WS port 6006 to
  JSON-RPC port 5005 (incl. edge cases: non-6006 ports and non-localhost hosts
  are left untouched, wss does not remap ports). Also assert NewClient wires
  the remapped URL.
- DropsToXRP: drops→XRP formatting, including sub-XRP amounts and unparseable
  input.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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