Skip to content

Commit

Permalink
testing pls send help
Browse files Browse the repository at this point in the history
  • Loading branch information
coliu-akamai committed Jan 10, 2025
1 parent 5e70be5 commit 589f7e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { renderWithThemeAndRouter } from 'src/utilities/testHelpers';

import { PLACEMENT_GROUP_LINODES_ERROR_MESSAGE } from '../../constants';
import { PlacementGroupsLinodes } from './PlacementGroupsLinodes';
import { migrationRouteTree } from 'src/routes';

const queryMocks = vi.hoisted(() => ({
useLocation: vi.fn().mockReturnValue({ pathname: '/placement-groups/1' }),
useParams: vi.fn().mockReturnValue({}),
useParams: vi.fn().mockReturnValue({ id: 1 }),
}));

vi.mock('@tanstack/react-router', async () => {
Expand All @@ -21,13 +22,17 @@ vi.mock('@tanstack/react-router', async () => {
});

describe('PlacementGroupsLinodes', () => {
it('renders an error state if placement groups are undefined', async () => {
it.only('renders an error state if placement groups are undefined', async () => {
const { getByText } = await renderWithThemeAndRouter(
<PlacementGroupsLinodes
isLinodeReadOnly={false}
placementGroup={undefined}
region={undefined}
/>
/>,
{
routeTree: migrationRouteTree,
initialRoute: '/placement-groups/1'
}
);

expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { renderWithThemeAndRouter } from 'src/utilities/testHelpers';

import { PlacementGroupsLanding } from './PlacementGroupsLanding';
import { headers } from './PlacementGroupsLandingEmptyStateData';
import { TanstackLink } from 'src/components/TanstackLinks';

const queryMocks = vi.hoisted(() => ({
useLocation: vi.fn().mockReturnValue({ pathname: '/placement-groups' }),
Expand Down Expand Up @@ -36,6 +37,14 @@ vi.mock('src/queries/placementGroups', async () => {
};
});

vi.mock('src/components/Link', async () => {
const actual = await vi.importActual('src/components/Link');
return {
...actual,
Link: TanstackLink,
};
});

describe('PlacementGroupsLanding', () => {
it('renders loading state', async () => {
queryMocks.usePlacementGroupsQuery.mockReturnValue({
Expand Down

0 comments on commit 589f7e8

Please sign in to comment.