Compare commits

..

1 Commits

Author SHA1 Message Date
d9e592cc97 Build [v1.10.1] 2026-04-15 17:41:34 +03:00
4 changed files with 3 additions and 70 deletions

View File

@@ -1,6 +1,6 @@
{
"version": "1.10.0",
"last_build": "2026-04-15-1731",
"version": "1.10.1",
"last_build": "2026-04-15-1741",
"codename": "ModularAdmin",
"commit": "074d4f1f"
"commit": "062df8cf"
}

View File

@@ -1,51 +0,0 @@
import { renderHook, waitFor } from '@testing-library/react';
import { useAdmin } from '@/hooks/useAdmin';
import { inventoryApi } from '@/lib/api';
import { vi, describe, it, expect } from 'vitest';
// Mock the API
vi.mock('@/lib/api', () => ({
inventoryApi: {
getUsers: vi.fn(),
getCategories: vi.fn(),
getLdapConfig: vi.fn(),
getDbBackups: vi.fn(),
getDbStats: vi.fn(),
getDbSettings: vi.fn(),
getAiPrompt: vi.fn(),
getAiConfig: vi.fn(),
}
}));
// Mock toast
vi.mock('react-hot-toast', () => ({
toast: {
error: vi.fn(),
success: vi.fn(),
}
}));
describe('useAdmin hook', () => {
it('should initialize with loading state and fetch data', async () => {
(inventoryApi.getUsers as any).mockResolvedValue([{ id: 1, username: 'testuser' }]);
(inventoryApi.getCategories as any).mockResolvedValue([]);
(inventoryApi.getLdapConfig as any).mockResolvedValue({ server_uri: 'ldap://fake' });
(inventoryApi.getDbBackups as any).mockResolvedValue([]);
(inventoryApi.getDbStats as any).mockResolvedValue({ backup_count: 0 });
(inventoryApi.getDbSettings as any).mockResolvedValue({ retention_count: 5 });
(inventoryApi.getAiPrompt as any).mockResolvedValue({ value: 'test prompt' });
(inventoryApi.getAiConfig as any).mockResolvedValue({ active_provider: 'gemini' });
const { result } = renderHook(() => useAdmin());
expect(result.current.loading).toBe(true);
await waitFor(() => {
expect(result.current.loading).toBe(false);
});
expect(result.current.users).toHaveLength(1);
expect(result.current.users[0].username).toBe('testuser');
expect(result.current.aiPrompt).toBe('test prompt');
});
});

View File

@@ -1,15 +0,0 @@
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
alias: {
'@': path.resolve(__dirname, './'),
},
},
});

View File

@@ -1 +0,0 @@
import '@testing-library/jest-dom';