34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import AccountAdminShell from '../AccountAdminShell.tsx';
|
|
|
|
vi.mock('../../context/AuthContext.tsx', () => ({
|
|
useAuth: () => ({
|
|
user: {
|
|
id: 9,
|
|
user_name: 'account_admin',
|
|
display_name: 'account_admin',
|
|
status: 'account_admin',
|
|
is_superuser: false,
|
|
created_at: '',
|
|
updated_at: '',
|
|
},
|
|
logout: vi.fn(),
|
|
}),
|
|
}));
|
|
|
|
vi.mock('../UserManagementPage.tsx', () => ({
|
|
default: () => <div>User management content</div>,
|
|
}));
|
|
|
|
describe('AccountAdminShell', () => {
|
|
it('shows only User Management nav, not ops dashboards', () => {
|
|
render(<AccountAdminShell />);
|
|
expect(screen.getByText('Manajemen Akun')).toBeInTheDocument();
|
|
expect(screen.getByText('User management content')).toBeInTheDocument();
|
|
expect(screen.queryByText('Dashboard')).not.toBeInTheDocument();
|
|
expect(screen.queryByText('Hitung Ayam')).not.toBeInTheDocument();
|
|
expect(screen.queryByText('FCR')).not.toBeInTheDocument();
|
|
});
|
|
});
|