From 78b81498ee103cd7e81c7979599445a7131a5e33 Mon Sep 17 00:00:00 2001 From: quangnt Date: Mon, 11 Dec 2023 15:21:51 +0700 Subject: [PATCH] feat: add test validate contract address --- packages/oraidex-server/tests/helper.spec.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/oraidex-server/tests/helper.spec.ts b/packages/oraidex-server/tests/helper.spec.ts index 4c3d3fb2..91fd23ac 100644 --- a/packages/oraidex-server/tests/helper.spec.ts +++ b/packages/oraidex-server/tests/helper.spec.ts @@ -1,4 +1,4 @@ -import { getDate24hBeforeNow } from "../src/helper"; +import { getDate24hBeforeNow, validateContractAddress } from "../src/helper"; describe("test-helper", () => { it("test-getDate24hBeforeNow", () => { @@ -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); + }); });