Skip to content

Commit

Permalink
test(caip): generic test + uses all KnowCaipNamespace values
Browse files Browse the repository at this point in the history
Co-authored-by: Elliot Winkler <[email protected]>
  • Loading branch information
ccharly and mcmire authored Mar 13, 2024
1 parent 066bde6 commit 3d1c24f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/caip-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
);
}

Check failure on line 302 in src/caip-types.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (16.x)

Insert `,`

Check failure on line 302 in src/caip-types.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (18.x)

Insert `,`

Check failure on line 302 in src/caip-types.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint (20.x)

Insert `,`
);

it.each([
// Too short, must have 3 chars at least
'',
Expand Down

0 comments on commit 3d1c24f

Please sign in to comment.