You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/sidebar/AzureSidebar/AzureSidebar.test.tsx

43 lines
1.4 KiB

import { UserContext } from '@/portainer/hooks/useUser';
import { UserViewModel } from '@/portainer/models/user';
import { render, within } from '@/react-tools/test-utils';
import { AzureSidebar } from './AzureSidebar';
test('dashboard items should render correctly', () => {
const { getByLabelText } = renderComponent();
const dashboardItem = getByLabelText('Dashboard');
expect(dashboardItem).toBeVisible();
expect(dashboardItem).toHaveTextContent('Dashboard');
const dashboardItemElements = within(dashboardItem);
expect(dashboardItemElements.getByLabelText('itemIcon')).toBeVisible();
expect(dashboardItemElements.getByLabelText('itemIcon')).toHaveClass(
'fa-tachometer-alt',
'fa-fw'
);
const containerInstancesItem = getByLabelText(/Container Instances/i);
expect(containerInstancesItem).toBeVisible();
expect(containerInstancesItem).toHaveTextContent('Container instances');
const containerInstancesItemElements = within(containerInstancesItem);
expect(
containerInstancesItemElements.getByLabelText('itemIcon')
).toBeVisible();
expect(containerInstancesItemElements.getByLabelText('itemIcon')).toHaveClass(
'fa-cubes',
'fa-fw'
);
});
function renderComponent() {
const user = new UserViewModel({ Username: 'user' });
return render(
<UserContext.Provider value={{ user }}>
<AzureSidebar environmentId={1} />
</UserContext.Provider>
);
}