Skip to content

feat(core-ts): detect() and validate() unit test suites (#189)#200

Merged
codeZe-us merged 1 commit intoBoxkit-Labs:mainfrom
jerrymusaga:feature/address-detection-validation-tests
Mar 29, 2026
Merged

feat(core-ts): detect() and validate() unit test suites (#189)#200
codeZe-us merged 1 commit intoBoxkit-Labs:mainfrom
jerrymusaga:feature/address-detection-validation-tests

Conversation

@jerrymusaga
Copy link
Copy Markdown
Contributor

Summary

  • Adds packages/core-ts/src/test/detect.test.ts — 20 assertions across 5 describe blocks
  • Adds packages/core-ts/src/test/validate.test.ts — 25 assertions across 5 describe blocks
  • Both files target the address/detect.ts and address/validate.ts utilities directly, extending beyond the minimal coverage in src/spec/

detect() coverage

Category Scenarios
Valid addresses G, M, C — correct kind returned
Case insensitivity lowercase G, lowercase M, mixed-case G
Corrupted checksums mutated last char (G), mutated last char (M), interior mutation
Structural failures empty string, whitespace, numeric, random string, truncated G/M, G with extra chars, all-A string
Wrong-prefix rejection S-key (secret), T-prefix (unknown), statelessness regression

validate() coverage

Category Scenarios
No-kind overload valid G/M/C → true; invalid string/empty → false
Kind-match G+G, M+M, C+C → true
Kind-mismatch G+M, G+C, M+G, M+C, C+G, C+M → false
Invalid inputs corrupted checksum (no kind and with kind), truncated, whitespace, S-key, extra chars
Case insensitivity lowercase G/M (with and without kind, including mismatch)

Test plan

  • CI pnpm --filter stellar-address-kit test passes green
  • tsc --noEmit reports zero errors on both files

Closes #189

…abs#189)

Adds packages/core-ts/src/test/detect.test.ts and validate.test.ts with
comprehensive coverage of the address detection and validation utilities.

detect() tests cover:
- Valid G / M / C addresses returning the correct kind
- Case-insensitive normalisation (lowercase and mixed-case inputs)
- Corrupted checksum detection returning "invalid"
- Structural failures: empty, whitespace, truncated, too-long, all-A strings
- Wrong-prefix rejection (S-keys, unknown prefixes)
- Statelessness regression (interleaved calls return consistent results)

validate() tests cover:
- No-kind overload: any valid address returns true
- Kind-match: each kind correctly returns true for itself
- Kind-mismatch: every (address, wrong-kind) pair returns false
- Invalid inputs: corrupted checksums, truncated, whitespace, secret keys
- Case insensitivity for G and M addresses

Closes Boxkit-Labs#189
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@jerrymusaga Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@codeZe-us codeZe-us self-requested a review March 29, 2026 15:01
Copy link
Copy Markdown
Contributor

@codeZe-us codeZe-us left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerrymusaga approved

@codeZe-us codeZe-us merged commit da7dd83 into Boxkit-Labs:main Mar 29, 2026
1 check failed
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.

Address Detection and Validation Unit Tests

2 participants