diff --git a/src/components/common/SafeTokenWidget/__tests__/SafeTokenWidget.test.tsx b/src/components/common/SafeTokenWidget/__tests__/SafeTokenWidget.test.tsx
index 2c57b9e188..02de5167a5 100644
--- a/src/components/common/SafeTokenWidget/__tests__/SafeTokenWidget.test.tsx
+++ b/src/components/common/SafeTokenWidget/__tests__/SafeTokenWidget.test.tsx
@@ -6,7 +6,7 @@ import { BigNumber } from 'ethers'
import SafeTokenWidget from '..'
import { hexZeroPad } from 'ethers/lib/utils'
import { AppRoutes } from '@/config/routes'
-import useSafeTokenAllocation from '@/hooks/useSafeTokenAllocation'
+import useSafeTokenAllocation, { useSafeTokenBalance } from '@/hooks/useSafeTokenAllocation'
const MOCK_GOVERNANCE_APP_URL = 'https://mock.governance.safe.global'
@@ -52,21 +52,24 @@ describe('SafeTokenWidget', () => {
it('Should render nothing for unsupported chains', () => {
;(useChainId as jest.Mock).mockImplementationOnce(jest.fn(() => '100'))
- ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [BigNumber.from(0), false])
+ ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [[], , false])
+ ;(useSafeTokenBalance as jest.Mock).mockImplementation(() => [BigNumber.from(0), , false])
const result = render()
expect(result.baseElement).toContainHTML('
')
})
it('Should display 0 if Safe has no SAFE token', async () => {
- ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [BigNumber.from(0), false])
+ ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [[], , false])
+ ;(useSafeTokenBalance as jest.Mock).mockImplementation(() => [BigNumber.from(0), , false])
const result = render()
await waitFor(() => expect(result.baseElement).toHaveTextContent('0'))
})
it('Should display the value formatted correctly', async () => {
- ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [BigNumber.from('472238796133701648384'), false])
+ ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [[], , false])
+ ;(useSafeTokenBalance as jest.Mock).mockImplementation(() => [BigNumber.from('472238796133701648384'), , false])
// to avoid failing tests in some environments
const NumberFormat = Intl.NumberFormat
@@ -82,7 +85,8 @@ describe('SafeTokenWidget', () => {
})
it('Should render a link to the governance app', async () => {
- ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [BigNumber.from(420000), false])
+ ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [[], , false])
+ ;(useSafeTokenBalance as jest.Mock).mockImplementation(() => [BigNumber.from(420000), , false])
const result = render()
await waitFor(() => {
@@ -91,4 +95,14 @@ describe('SafeTokenWidget', () => {
)
})
})
+
+ it('Should render a claim button for SEP5 qualification', async () => {
+ ;(useSafeTokenAllocation as jest.Mock).mockImplementation(() => [[{ tag: 'user_v2' }], , false])
+ ;(useSafeTokenBalance as jest.Mock).mockImplementation(() => [BigNumber.from(420000), , false])
+
+ const result = render()
+ await waitFor(() => {
+ expect(result.baseElement).toContainHTML('New allocation')
+ })
+ })
})