Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Sep 6, 2023
1 parent 9445f7c commit c504d1f
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"publint": "^0.2.0",
"rimraf": "^4.4.1",
"simple-git-hooks": "^2.8.1",
"typescript": "5.0.4",
"typescript": "5.1.6",
"viem": "0.0.0-alpha-20230906150254",
"vite": "^4.3.9",
"vitest": "^0.34.1"
Expand Down
3 changes: 3 additions & 0 deletions packages/react/src/exports/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ test('exports', () => {
{
"connect": [Function],
"disconnect": [Function],
"estimateGas": [Function],
"getAccount": [Function],
"getBalance": [Function],
"getBlockNumber": [Function],
"getChainId": [Function],
"getConnections": [Function],
"getConnectorClient": [Function],
"getEnsAddress": [Function],
"getEnsAvatar": [Function],
"getEnsName": [Function],
"getEnsResolver": [Function],
"getFeeData": [Function],
"getToken": [Function],
"getTransaction": [Function],
"multicall": [Function],
"readContract": [Function],
"readContracts": [Function],
"reconnect": [Function],
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/exports/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test('exports', () => {
"useEnsAvatar",
"useEnsName",
"useEnsResolver",
"useEstimateGas",
"useFeeData",
"useContractSimulate",
"useReconnect",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { defineProject } from 'vitest/config'
export default defineProject({
resolve: {
alias: {
'@wagmi/core': path.resolve(__dirname, '../core/src'),
'@wagmi/core': path.resolve(__dirname, '../core/src/exports'),
'@wagmi/connectors': path.resolve(__dirname, '../connectors/src'),
},
},
Expand Down
19 changes: 19 additions & 0 deletions packages/register-tests/react/src/useContractSimulate.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { abi } from '@wagmi/test'
import type { Address } from 'viem'
import { expectTypeOf, test } from 'vitest'
import { type UseContractSimulateParameters, useContractSimulate } from 'wagmi'
import type { SimulateContractParameters } from 'wagmi/actions'
import { celo, mainnet, optimism } from 'wagmi/chains'
import type { SimulateContractOptions } from 'wagmi/query'

import { type ChainId, config } from './config.js'

Expand Down Expand Up @@ -66,4 +68,21 @@ test('UseContractSimulateParameters', () => {
expectTypeOf<Result2['gatewayFeeRecipient']>().toEqualTypeOf<
`0x${string}` | undefined
>()

type Result3 = SimulateContractParameters<
typeof abi.erc20,
'transferFrom',
[Address, Address, bigint],
typeof config,
typeof celo.id
>
expectTypeOf<Result3['chainId']>().toEqualTypeOf<ChainId | undefined>()
type Result4 = SimulateContractOptions<
typeof abi.erc20,
'transferFrom',
[Address, Address, bigint],
typeof config,
typeof celo.id
>
expectTypeOf<Result4['chainId']>().toEqualTypeOf<ChainId | undefined>()
})
78 changes: 36 additions & 42 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit c504d1f

@vercel
Copy link

@vercel vercel bot commented on c504d1f Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wagmi-v2 – ./docs

wagmi-v2-git-alpha-wagmi-dev.vercel.app
wagmi-v2-wagmi-dev.vercel.app
wagmi-v2.vercel.app
alpha.wagmi.sh

Please sign in to comment.