Skip to content

Commit

Permalink
adjust tests with more relevant data
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Jan 16, 2025
1 parent a735b6a commit c8ca2b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from '@/zodiac'
import { screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { Chain } from '@zodiac/chains'
import { expectRouteToBe } from '@zodiac/test-utils'
import { getAddress } from 'ethers'
import {
Expand Down Expand Up @@ -190,7 +191,7 @@ describe('Edit Zodiac route', () => {
const address = randomAddress()

await userEvent.type(
screen.getByRole('combobox', { name: 'Piloted Safe' }),
screen.getByRole('textbox', { name: 'Piloted Safe' }),
`${address}[enter]`,
)
await userEvent.click(
Expand Down Expand Up @@ -478,13 +479,16 @@ describe('Edit Zodiac route', () => {
)

await userEvent.type(
screen.getByRole('combobox', { name: 'Piloted Safe' }),
screen.getByRole('textbox', { name: 'Piloted Safe' }),
randomAddress(),
)

const [, avatarAddress] = splitPrefixedAddress(route.avatar)

expect(mockFetchZodiacModules).toHaveBeenCalledWith(avatarAddress, 42161)
expect(mockFetchZodiacModules).toHaveBeenCalledWith(
avatarAddress,
Chain.ARB1,
)
})
})

Expand Down Expand Up @@ -606,6 +610,7 @@ describe('Edit Zodiac route', () => {
const selectedRoute = createMockRoute({
id: 'firstRoute',
label: 'First route',
avatar: randomPrefixedAddress(),
})

await mockRoutes(selectedRoute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { ETH_ZERO_ADDRESS, ZERO_ADDRESS } from '@zodiac/chains'
import { expectRouteToBe } from '@zodiac/test-utils'
import { expectRouteToBe, randomPrefixedAddress } from '@zodiac/test-utils'
import { describe, expect, it } from 'vitest'
import { action, ListRoutes, loader } from './ListRoutes'

Expand Down Expand Up @@ -59,13 +59,18 @@ describe('List routes', () => {

it('is possible to launch a new route and clear transactions', async () => {
const selectedRoute = createMockRoute({
avatar: randomPrefixedAddress(),
id: 'firstRoute',
label: 'First route',
})

await saveLastUsedRouteId('firstRoute')

mockRoutes(selectedRoute, { id: 'secondRoute', label: 'Second route' })
mockRoutes(selectedRoute, {
id: 'secondRoute',
label: 'Second route',
avatar: randomPrefixedAddress(),
})

await render(
'/routes',
Expand Down Expand Up @@ -94,11 +99,13 @@ describe('List routes', () => {
describe('Clearing transactions', () => {
it('warns about clearing transactions when the avatars differ', async () => {
const selectedRoute = createMockRoute({
avatar: randomPrefixedAddress(),
id: 'firstRoute',
label: 'First route',
})

await mockRoutes(selectedRoute, {
avatar: randomPrefixedAddress(),
id: 'secondRoute',
label: 'Second route',
})
Expand Down

0 comments on commit c8ca2b6

Please sign in to comment.