Skip to content

Commit

Permalink
rename file plus add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Oct 9, 2024
1 parent be8c257 commit 68c7899
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/customChains.unit.test.ts

This file was deleted.

31 changes: 31 additions & 0 deletions src/validateParentChain.unit.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { it, expect } from 'vitest';

import { validateParentChain } from './types/ParentChain';
import { arbitrumOne, registerCustomParentChain } from './chains';
import { generateChainId } from './utils';

import { testHelper_createCustomParentChain } from './customChainsTestHelpers';

it(`sucessfully validates arbitrum one`, () => {
const result = validateParentChain(arbitrumOne.id);

expect(result.chainId).toEqual(arbitrumOne.id);
expect(result.isCustom).toEqual(false);
});

it(`throws for an unregistered custom parent chain`, () => {
const id = generateChainId();

expect(() => validateParentChain(id)).toThrowError(`Parent chain not supported: ${id}`);
});

it(`sucessfully validates a registered custom parent chain`, () => {
const chain = testHelper_createCustomParentChain();

registerCustomParentChain(chain);

const result = validateParentChain(chain.id);

expect(result.chainId).toEqual(chain.id);
expect(result.isCustom).toEqual(true);
});

0 comments on commit 68c7899

Please sign in to comment.