From 3d1c24f522b6d7ffc3a050ec667ce0d23cd5bcaa Mon Sep 17 00:00:00 2001 From: Charly Chevalier Date: Wed, 13 Mar 2024 23:02:46 +0100 Subject: [PATCH] test(caip): generic test + uses all KnowCaipNamespace values Co-authored-by: Elliot Winkler --- src/caip-types.test.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/caip-types.test.ts b/src/caip-types.test.ts index 77b57d841..ea8df8e2e 100644 --- a/src/caip-types.test.ts +++ b/src/caip-types.test.ts @@ -284,14 +284,24 @@ describe('toCaipChainId', () => { // tested with a variety of inputs. // Here we mainly focus on our own wrapper around those: - it('returns a valid CAIP-2 chain ID', () => { - const namespace = KnownCaipNamespace.Eip155; + it('returns a valid CAIP-2 chain ID when given a valid namespace and reference', () => { + const namespace = 'abc'; const reference = '1'; expect(toCaipChainId(namespace, reference)).toBe( `${namespace}:${reference}`, ); }); + it.each(Object.values(KnownCaipNamespace))( + 'treats %s as a valid namespace', + (namespace) => { + const reference = '1'; + expect(toCaipChainId(namespace, reference)).toBe( + `${namespace}:${reference}`, + ); + } + ); + it.each([ // Too short, must have 3 chars at least '',