diff --git a/utils/validateAddress.test.ts b/utils/validateAddress.test.ts index f18e560..88a2c79 100644 --- a/utils/validateAddress.test.ts +++ b/utils/validateAddress.test.ts @@ -12,10 +12,12 @@ describe("test validateAddress", () => { "tDVW", "cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US_", "_cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US", + "cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US_AELF", + "ELF_cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US", + "ELF_cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US_aelf", ])("should throw: %s", (a) => { expect(() => validateAddress(a, ChainStateEnum.AELF)).toThrowError(); }); - test.each([ "", "cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US", @@ -23,4 +25,4 @@ describe("test validateAddress", () => { ])("should not throw: %s", (a) => { expect(() => validateAddress(a, ChainStateEnum.AELF)).not.toThrowError(); }); -}); +}); \ No newline at end of file diff --git a/utils/validateAddress.ts b/utils/validateAddress.ts index 25d3642..70c82cd 100644 --- a/utils/validateAddress.ts +++ b/utils/validateAddress.ts @@ -1,6 +1,6 @@ import bs58 from "bs58"; import AElf from "aelf-sdk"; -import {ChainStateEnum} from "@/state"; +import {ChainStateEnum} from "../state"; const { decodeAddressRep } = AElf.utils; @@ -25,4 +25,4 @@ export const validateAddress = ( } catch (err) { throw new Error("Oops! Please input a valid AELF network address!"); } -}; +}; \ No newline at end of file