Skip to content

Commit

Permalink
adjust specs
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Dec 18, 2024
1 parent 967afee commit a7f3e71
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions extension/src/panel/pages/routes/list/ListRoutes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ describe('List routes', () => {
'/routes',
[{ path: '/routes', Component: ListRoutes, loader, action }],
{
initialSelectedRoute: selectedRoute,
initialState: [createTransaction()],
inspectRoutes: [
'/:activeRouteId/clear-transactions/:newActiveRouteId',
Expand All @@ -90,20 +89,6 @@ describe('List routes', () => {

await expectRouteToBe('/firstRoute/clear-transactions/secondRoute')
})

it('works without an active route', async () => {
await mockRoute({ id: 'test-route' })

await render(
'/routes/list',
[{ path: '/routes/list', Component: ListRoutes, loader, action }],
{ inspectRoutes: ['/:activeRouteId'], initialSelectedRoute: null },
)

await userEvent.click(screen.getByRole('button', { name: 'Launch' }))

await expectRouteToBe('/test-route')
})
})

describe('Clearing transactions', () => {
Expand All @@ -113,13 +98,16 @@ describe('List routes', () => {
label: 'First route',
})

mockRoutes(selectedRoute, { id: 'secondRoute', label: 'Second route' })
await mockRoutes(selectedRoute, {
id: 'secondRoute',
label: 'Second route',
})
await saveLastUsedRouteId(selectedRoute.id)

await render(
'/routes',
[{ path: '/routes', Component: ListRoutes, loader, action }],
{
initialSelectedRoute: selectedRoute,
initialState: [createTransaction()],
},
)
Expand Down Expand Up @@ -174,15 +162,15 @@ describe('List routes', () => {
label: 'First route',
})

mockRoutes(selectedRoute, { id: 'secondRoute', label: 'Second route' })
await mockRoutes(selectedRoute, {
id: 'secondRoute',
label: 'Second route',
})
await saveLastUsedRouteId(selectedRoute.id)

await render(
'/routes',
[{ path: '/routes', Component: ListRoutes, loader, action }],
{
initialSelectedRoute: selectedRoute,
},
)
await render('/routes', [
{ path: '/routes', Component: ListRoutes, loader, action },
])

const { getByRole } = within(
screen.getByRole('region', { name: 'Second route' }),
Expand Down

0 comments on commit a7f3e71

Please sign in to comment.