Skip to content

Commit

Permalink
test: up
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Sep 27, 2024
1 parent 87c378b commit 7da3001
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
7 changes: 6 additions & 1 deletion packages/core/src/actions/sendTransaction.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { config, privateKey, transactionHashRegex } from '@wagmi/test'
import { parseEther } from 'viem'
import { expect, test } from 'vitest'
import { beforeEach, expect, test } from 'vitest'

import { privateKeyToAccount } from 'viem/accounts'
import { connect } from './connect.js'
Expand All @@ -9,6 +9,11 @@ import { sendTransaction } from './sendTransaction.js'

const connector = config.connectors[0]!

beforeEach(async () => {
if (config.state.current === connector.uid)
await disconnect(config, { connector })
})

test('default', async () => {
await connect(config, { connector })
await expect(
Expand Down
17 changes: 10 additions & 7 deletions packages/react/src/hooks/useBalance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ test('default', async () => {

await waitFor(() => expect(result.current.isSuccess).toBeTruthy())

expect(result.current).toMatchInlineSnapshot(`
const { data, ...rest } = result.current
expect(data).toMatchObject(
expect.objectContaining({
decimals: expect.any(Number),
formatted: expect.any(String),
symbol: expect.any(String),
value: expect.any(BigInt),
}),
)
expect(rest).toMatchInlineSnapshot(`
{
"data": {
"decimals": 18,
"formatted": "10000",
"symbol": "ETH",
"value": 10000000000000000000000n,
},
"dataUpdatedAt": 1675209600000,
"error": null,
"errorUpdateCount": 0,
Expand Down
16 changes: 8 additions & 8 deletions packages/vue/src/composables/useBalance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ test('default', async () => {

await waitFor(query.isSuccess)

expect(query.data.value).toMatchInlineSnapshot(`
{
"decimals": 18,
"formatted": "10000",
"symbol": "ETH",
"value": 10000000000000000000000n,
}
`)
expect(query.data.value).toMatchObject(
expect.objectContaining({
decimals: expect.any(Number),
formatted: expect.any(String),
symbol: expect.any(String),
value: expect.any(BigInt),
}),
)
})

test('parameters: chainId', async () => {
Expand Down

0 comments on commit 7da3001

Please sign in to comment.