Skip to content

Commit

Permalink
feat: add test validate contract address
Browse files Browse the repository at this point in the history
  • Loading branch information
quangdz1704 committed Dec 11, 2023
1 parent 439d83d commit 78b8149
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/oraidex-server/tests/helper.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDate24hBeforeNow } from "../src/helper";
import { getDate24hBeforeNow, validateContractAddress } from "../src/helper";

describe("test-helper", () => {
it("test-getDate24hBeforeNow", () => {
Expand All @@ -9,4 +9,16 @@ describe("test-helper", () => {
// assert
expect(result).toEqual(new Date("2023-07-15T16:07:48.000Z"));
});

it.each([
["orai", false],
["orai1234", false],
["abc", false],
["orai1lus0f0rhx8s03gdllx2n6vhkmf0536dv57wfge", true], // ORAIX
["orai12hzjxfh77wl572gdzct2fxv2arxcwh6gykc7qh", true] // USDT
])("test-validateContractAddress", (contractAddress, expected) => {
const checkContractAddress = validateContractAddress(contractAddress);
// assert
expect(checkContractAddress).toEqual(expected);
});
});

0 comments on commit 78b8149

Please sign in to comment.