Skip to content

Commit

Permalink
switch PG create back to react router dom (used in LinodeCreate as well)
Browse files Browse the repository at this point in the history
  • Loading branch information
coliu-akamai committed Jan 7, 2025
1 parent 18984b0 commit 98d9826
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { fireEvent, waitFor } from '@testing-library/react';
import * as React from 'react';

import { placementGroupFactory } from 'src/factories';
import { renderWithThemeAndRouter } from 'src/utilities/testHelpers';
// eslint-disable-next-line no-restricted-imports
import { renderWithTheme } from 'src/utilities/testHelpers';

import { PlacementGroupsCreateDrawer } from './PlacementGroupsCreateDrawer';

Expand Down Expand Up @@ -31,12 +32,8 @@ vi.mock('src/queries/placementGroups', async () => {
});

describe('PlacementGroupsCreateDrawer', () => {
it('should render and have its fields enabled', async () => {
const {
getAllByRole,
getByLabelText,
getByText,
} = await renderWithThemeAndRouter(
it('should render and have its fields enabled', () => {
const { getAllByRole, getByLabelText, getByText } = renderWithTheme(
<PlacementGroupsCreateDrawer {...commonProps} />
);

Expand All @@ -50,8 +47,8 @@ describe('PlacementGroupsCreateDrawer', () => {
expect(radioInputs[0]).toBeChecked();
});

it('Placement Group Type select should have the correct options', async () => {
const { getByPlaceholderText, getByText } = await renderWithThemeAndRouter(
it('Placement Group Type select should have the correct options', () => {
const { getByPlaceholderText, getByText } = renderWithTheme(
<PlacementGroupsCreateDrawer {...commonProps} />
);

Expand All @@ -66,13 +63,15 @@ describe('PlacementGroupsCreateDrawer', () => {
});

it('should populate the region select with the selected region prop', async () => {
const { getByText } = await renderWithThemeAndRouter(
const { getByText } = renderWithTheme(
<PlacementGroupsCreateDrawer
selectedRegionId="us-east"
{...commonProps}
/>,
{
initialRoute: 'linodes/create',
MemoryRouter: {
initialEntries: ['/linodes/create'],
},
}
);

Expand All @@ -87,9 +86,7 @@ describe('PlacementGroupsCreateDrawer', () => {
getByPlaceholderText,
getByRole,
getByText,
} = await renderWithThemeAndRouter(
<PlacementGroupsCreateDrawer {...commonProps} />
);
} = renderWithTheme(<PlacementGroupsCreateDrawer {...commonProps} />);

fireEvent.change(getByLabelText('Label'), {
target: { value: 'my-label' },
Expand Down Expand Up @@ -124,7 +121,7 @@ describe('PlacementGroupsCreateDrawer', () => {
data: [placementGroupFactory.build({ region: 'us-west' })],
});
const regionWithoutCapacity = 'US, Fremont, CA (us-west)';
const { getByPlaceholderText, getByText } = await renderWithThemeAndRouter(
const { getByPlaceholderText, getByText } = renderWithTheme(
<PlacementGroupsCreateDrawer {...commonProps} />
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
Typography,
} from '@linode/ui';
import { createPlacementGroupSchema } from '@linode/validation';
import { useLocation } from '@tanstack/react-router';
import { useFormik } from 'formik';
import { useSnackbar } from 'notistack';
import * as React from 'react';
// eslint-disable-next-line no-restricted-imports
import { useLocation } from 'react-router-dom';

import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel';
import { DescriptionList } from 'src/components/DescriptionList/DescriptionList';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CircleProgress, Notice, Typography } from '@linode/ui';
import { useParams } from '@tanstack/react-router';
import { useSnackbar } from 'notistack';
import * as React from 'react';
import { useParams } from '@tanstack/react-router';

import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel';
import { ConfirmationDialog } from 'src/components/ConfirmationDialog/ConfirmationDialog';
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/features/PlacementGroups/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PlacementGroup, Region } from '@linode/api-v4';
import type { PlacementGroup, Region } from '@linode/api-v4';

export interface PlacementGroupsDrawerPropsBase {
onClose: () => void;
Expand Down

0 comments on commit 98d9826

Please sign in to comment.