Skip to content

Commit

Permalink
fix: rooch-sdk-kit error build
Browse files Browse the repository at this point in the history
  • Loading branch information
nlyrthiia committed Sep 13, 2024
1 parent b0f1dfc commit 4a54f44
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions sdk/typescript/rooch-sdk-kit/test/case/use-default-client.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from 'react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { renderHook, waitFor, act } from '@testing-library/react'
import { renderHook, waitFor } from '@testing-library/react'
import {
ErrorValidateSessionIsExpired,
JsonRpcError,
Expand Down Expand Up @@ -77,10 +77,7 @@ describe('useDefaultClient', () => {
}

const wrapper = createWalletProviderContextWrapper({}, mockClient)
let result: any
await act(async () => {
result = renderHook(() => useTestHook(), { wrapper })
})
const { result } = renderHook(() => useTestHook(), { wrapper })

await waitFor(() => {
expect(result.current.sessions).toHaveLength(2)
Expand All @@ -92,12 +89,9 @@ describe('useDefaultClient', () => {
return cachedCurrentSession!.getAuthKey() === s.getAuthKey()
}

await act(async () => {
await expect(result.current.triggerSessionExpiredError()).rejects.toThrow(
'[test] session expired',
)
})

await expect(result.current.triggerSessionExpiredError).rejects.toThrow(
'[test] session expired',
)
expect(result.current.sessions).toHaveLength(1)
expect(result.current.sessions.find(getMatchedSessionByAuthKey)).toBeUndefined()
})
Expand Down

0 comments on commit 4a54f44

Please sign in to comment.