Skip to content

Commit

Permalink
fix: Test case update
Browse files Browse the repository at this point in the history
  • Loading branch information
Faizal-aelf committed Nov 16, 2023
1 parent 5febf91 commit 61b321f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions utils/validateAddress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ 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",
"ELF_cDPLA9axUVeujnTTk4Cyr3aqRby3cHHAB6Rh28o7BRTTxi8US_AELF",
])("should not throw: %s", (a) => {
expect(() => validateAddress(a, ChainStateEnum.AELF)).not.toThrowError();
});
});
});
4 changes: 2 additions & 2 deletions utils/validateAddress.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -25,4 +25,4 @@ export const validateAddress = (
} catch (err) {
throw new Error("Oops! Please input a valid AELF network address!");
}
};
};

0 comments on commit 61b321f

Please sign in to comment.