mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
refactor(nomad): sync frontend with EE [EE-3353] (#7758)
This commit is contained in:
parent
78dcba614d
commit
881e99df53
68 changed files with 1799 additions and 17 deletions
38
app/react/sidebar/NomadSidebar/NomadSidebar.test.tsx
Normal file
38
app/react/sidebar/NomadSidebar/NomadSidebar.test.tsx
Normal file
|
@ -0,0 +1,38 @@
|
|||
import { UserContext } from '@/react/hooks/useUser';
|
||||
import { UserViewModel } from '@/portainer/models/user';
|
||||
import { render, within } from '@/react-tools/test-utils';
|
||||
|
||||
import { TestSidebarProvider } from '../useSidebarState';
|
||||
|
||||
import { NomadSidebar } from './NomadSidebar';
|
||||
|
||||
test('dashboard items should render correctly', () => {
|
||||
const { getByLabelText } = renderComponent();
|
||||
const dashboardItem = getByLabelText(/Dashboard/i);
|
||||
expect(dashboardItem).toBeVisible();
|
||||
expect(dashboardItem).toHaveTextContent('Dashboard');
|
||||
|
||||
const dashboardItemElements = within(dashboardItem);
|
||||
expect(
|
||||
dashboardItemElements.getByRole('img', { hidden: true })
|
||||
).toBeVisible();
|
||||
|
||||
const jobsItem = getByLabelText('Nomad Jobs');
|
||||
expect(jobsItem).toBeVisible();
|
||||
expect(jobsItem).toHaveTextContent('Jobs');
|
||||
|
||||
const jobsItemElements = within(jobsItem);
|
||||
expect(jobsItemElements.getByRole('img', { hidden: true })).toBeVisible();
|
||||
});
|
||||
|
||||
function renderComponent() {
|
||||
const user = new UserViewModel({ Username: 'user' });
|
||||
|
||||
return render(
|
||||
<UserContext.Provider value={{ user }}>
|
||||
<TestSidebarProvider>
|
||||
<NomadSidebar environmentId={1} />
|
||||
</TestSidebarProvider>
|
||||
</UserContext.Provider>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue