From 995a7f0ef96f7743f028a0d7fc7291deee73fb69 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Thu, 5 Sep 2024 14:59:16 +0100 Subject: [PATCH] wip: add unit test --- src/utils/index.ts | 1 + test/unit/AssetUtils.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/unit/AssetUtils.ts diff --git a/src/utils/index.ts b/src/utils/index.ts index 5e99d811..55da7cf7 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -10,3 +10,4 @@ export * from './SignatureUtils' export * from './TokenUtils' export * from './ProviderErrors' export * from './OrderUtils' +export * from './Assets' diff --git a/test/unit/AssetUtils.ts b/test/unit/AssetUtils.ts new file mode 100644 index 00000000..38c173f1 --- /dev/null +++ b/test/unit/AssetUtils.ts @@ -0,0 +1,27 @@ +import { assert } from 'chai' +import { KNOWN_CONFIDENTIAL_EVMS } from '../../src/config' +import { isConfidentialEVM } from '../../src/utils' + +describe('Asste utils (createAsset)', () => { + it('should check if confidential EVM', async () => { + for (const name of KNOWN_CONFIDENTIAL_EVMS.names) { + assert( + isConfidentialEVM(name) === true, + `Network: "${name}" is not a confidental EVM` + ) + } + for (const chain of KNOWN_CONFIDENTIAL_EVMS.chainIds) { + assert( + isConfidentialEVM(chain) === true, + `Chain Id: "${chain}" is not a confidental EVM` + ) + } + + // optimism sepolia + // 11155420 + assert( + isConfidentialEVM(11155420) === false, + `Chain Id: "11155420" is wrongly considered a confidental EVM` + ) + }) +})