From 6536940e4013610d18ae98db501f6b8841789339 Mon Sep 17 00:00:00 2001 From: gcoinstash-cmd Date: Sun, 6 Sep 2026 04:04:49 -0700 Subject: [PATCH] test(wallet): add Stellar public key prefix and checksum length validation specs --- .../wave_stellar_address_checksum.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/utils/__tests__/wave_stellar_address_checksum.test.ts diff --git a/src/utils/__tests__/wave_stellar_address_checksum.test.ts b/src/utils/__tests__/wave_stellar_address_checksum.test.ts new file mode 100644 index 0000000..efe5f0b --- /dev/null +++ b/src/utils/__tests__/wave_stellar_address_checksum.test.ts @@ -0,0 +1,15 @@ +describe('Wave Sprint: Stellar Public Key Checksum Validation', () => { + const isValidStellarAddress = (addr: string): boolean => { + return typeof addr === 'string' && addr.startsWith('G') && addr.length === 56; + }; + + it('should validate 56-character G-prefixed Stellar public address', () => { + const validAddr = 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5'; + expect(isValidStellarAddress(validAddr)).toBe(true); + }); + + it('should reject invalid length or prefix Stellar addresses', () => { + expect(isValidStellarAddress('ABBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5')).toBe(false); + expect(isValidStellarAddress('GBBD47IF6LWK7P7MDEVSCWR7DPUW')).toBe(false); + }); +});