Repository navigation
Testing
nansen-go ships with a unit test suite that covers the retry and backoff logic, error mapping, and option validation.
Run the full test suite with the standard Go toolchain:
go test ./...No API key is required to run the tests — they use an in-process HTTP test server to simulate API responses.
The test suite focuses on the internal behaviour of the client rather than the shape of individual API responses:
Retry and backoff logic. Tests verify that the client retries 429 and 5xx responses the correct number of times, that the backoff delay grows exponentially and is capped at maxDelay, and that the Retry-After header is honoured when present.
Error mapping. Tests verify that each HTTP status code is correctly mapped to the appropriate sentinel error (ErrNotFound, ErrUnauthorized, ErrRateLimited, etc.) and that errors.Is returns the expected result.
Option validation. Tests verify that nansen.New returns an error for invalid inputs such as an empty API key, a nil HTTP client, a non-positive timeout, or an invalid retry configuration.
The repository is configured to run go test ./... on every push and pull request. The test suite is intentionally kept free of external dependencies and network calls, so it runs reliably in any CI environment.