@@ -767,44 +767,39 @@ describe('CurrencyManager', () => {
767
767
} ) ;
768
768
769
769
describe ( 'validateAleoAddress' , ( ) => {
770
- it ( 'should validate correct Aleo addresses' , ( ) => {
771
- const validAddress = 'aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8' ;
772
- expect ( currencyManager . validateAleoAddress ( validAddress ) ) . toBe ( true ) ;
773
- expect ( currencyManager . validateAleoAddress ( validAddress . toUpperCase ( ) ) ) . toBe ( true ) ;
774
- } ) ;
775
-
776
- it ( 'should reject invalid Aleo addresses' , ( ) => {
777
- const invalidAddresses = [
778
- // Empty or null inputs
779
- '' ,
780
- ' ' ,
781
- null ,
782
- undefined ,
783
- // Wrong prefix
784
- 'bitcoin1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8' ,
785
- 'cosmos1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8' ,
786
- // Mixed case
787
- 'aleo1Qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8' ,
788
- // Wrong format
789
- 'aleo1' ,
790
- 'aleo1abc' ,
791
- 'not-an-address' ,
792
- 'random-string' ,
793
- // Invalid characters that would pass simple regex but fail Bech32
794
- 'aleo1' + 'b' . repeat ( 58 ) , // 'b' not in Bech32 alphabet
795
- 'aleo1' + 'i' . repeat ( 58 ) , // 'i' not in Bech32 alphabet
796
- 'aleo1' + 'o' . repeat ( 58 ) , // 'o' not in Bech32 alphabet
797
- // Non-string inputs
798
- 123 ,
799
- { } ,
800
- [ ] ,
801
- // valid address with whitespace
802
- ' aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 ' ,
803
- ] ;
770
+ it ( 'should validate correct Aleo field elements' , ( ) => {
771
+ // Known valid Aleo field elements
772
+ expect (
773
+ currencyManager . validateAleoAddress (
774
+ '7311977476241952331367670434347097026669181172395481678807963832961201831695field' ,
775
+ ) ,
776
+ ) . toBe ( true ) ;
777
+ expect (
778
+ currencyManager . validateAleoAddress (
779
+ '6088188135219746443092391282916151282477828391085949070550825603498725268775field' ,
780
+ ) ,
781
+ ) . toBe ( true ) ;
782
+ } ) ;
804
783
805
- invalidAddresses . forEach ( ( address ) => {
806
- expect ( currencyManager . validateAleoAddress ( address as any ) ) . toBe ( false ) ;
807
- } ) ;
784
+ it ( 'should reject invalid addresses' , ( ) => {
785
+ expect (
786
+ currencyManager . validateAleoAddress (
787
+ '7311977476241952331367670434347097026669181172395481678807963832961201831695' ,
788
+ ) ,
789
+ ) . toBe ( false ) ;
790
+ expect ( currencyManager . validateAleoAddress ( '123FIELD' ) ) . toBe ( false ) ;
791
+ expect ( currencyManager . validateAleoAddress ( '123field' ) ) . toBe ( false ) ;
792
+ expect (
793
+ currencyManager . validateAleoAddress (
794
+ '731197747624195233136767043434709702666918117239548167880796383296120183169512345field' ,
795
+ ) ,
796
+ ) . toBe ( false ) ;
797
+ expect (
798
+ currencyManager . validateAleoAddress (
799
+ '73119774762419523313676704343470970266691811723954816788079638329612018316abfield' ,
800
+ ) ,
801
+ ) . toBe ( false ) ;
802
+ expect ( currencyManager . validateAleoAddress ( '' ) ) . toBe ( false ) ;
808
803
} ) ;
809
804
} ) ;
810
805
} ) ;
0 commit comments