From 0ee28f3a5c9eebc9212afe7679ffdb2ac6ade47a Mon Sep 17 00:00:00 2001 From: Hw <56923450+waddaboo@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:28:05 +0800 Subject: [PATCH] test(libs-utils): add more tests to improve test coverage --- libs/utils/src/index.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libs/utils/src/index.test.ts b/libs/utils/src/index.test.ts index 14f656f5..26bc15db 100644 --- a/libs/utils/src/index.test.ts +++ b/libs/utils/src/index.test.ts @@ -1,3 +1,4 @@ +import { blockchainCredentialSupportedNetworks } from "./getSupportedNetworks" import shortenAddress from "./shortenAddress" describe("Utils", () => { @@ -10,4 +11,30 @@ describe("Utils", () => { expect(address).toBe("0x1234...7890") }) }) + + describe("# blockchainCredentialSupportedNetworks", () => { + it("Should return a list of blockchain credential supported network", () => { + const networks = blockchainCredentialSupportedNetworks + + expect(networks).toHaveLength( + blockchainCredentialSupportedNetworks.length + ) + }) + + it("Should return a blockchain credential supported network", () => { + const expected = { + id: "sepolia", + name: "Sepolia" + } + const id = blockchainCredentialSupportedNetworks.find( + (i) => i.id === expected.id + ) + const name = blockchainCredentialSupportedNetworks.find( + (i) => i.name === expected.name + ) + + expect(id).toMatchObject(expected) + expect(name).toMatchObject(expected) + }) + }) })