test: add widget tests for FrontHallPage

- Add 14 widget tests covering:
  - Welcome message and Quick Links panel display
  - System Stats and Environment sections
  - Loading and error states
  - API endpoint verification
  - Default links fallback behavior
  - Category headers display

- Fix fixtures:
  - Add SystemStats fixture for dashboard content
  - Remove duplicate quickLinks definition
  - Update quickLinks endpoint to /dashboard/quick-links

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jeroen Schweitzer
2026-01-05 22:14:27 +01:00
co-authored by Claude Opus 4.5
parent d6fd9aea60
commit 837ccb6709
3 changed files with 308 additions and 38 deletions
+75 -37
View File
@@ -202,36 +202,6 @@ class Fixtures {
static Map<String, dynamic> group(int index) =>
Map<String, dynamic>.from(groups[index]);
// ============================================================
// Quick Links
// ============================================================
static const quickLinks = [
{
'id': 1,
'title': 'Portainer',
'url': 'https://portainer.schweitz.net',
'icon': 'dns',
'category': 'Infrastructure',
'position': 0,
'is_visible': true,
'link_type': 'iframe',
},
{
'id': 2,
'title': 'Gitea',
'url': 'https://git.schweitz.net',
'icon': 'code',
'category': 'Development',
'position': 1,
'is_visible': true,
'link_type': 'new_tab',
},
];
static Map<String, dynamic> quickLink(int index) =>
Map<String, dynamic>.from(quickLinks[index]);
// ============================================================
// Auth Sync Response
// ============================================================
@@ -269,15 +239,83 @@ class Fixtures {
}
// ============================================================
// System Stats
// System Stats (for DashboardContent)
// ============================================================
static const systemStats = {
'cpu_percent': 23.5,
'memory_percent': 45.2,
'disk_percent': 67.8,
'uptime_seconds': 864000,
'container_count': 12,
'container_running': 10,
'cpu': {
'usage_percent': 23.5,
'cores': 8,
'load_1m': 1.2,
'load_5m': 1.5,
'load_15m': 1.3,
},
'memory': {
'usage_percent': 45.2,
'total_bytes': 17179869184,
'used_bytes': 7771729306,
'available_bytes': 9408139878,
},
'disks': [
{
'mount_point': '/',
'device': '/dev/sda1',
'fstype': 'ext4',
'usage_percent': 67.8,
'total_bytes': 500000000000,
'used_bytes': 339000000000,
'free_bytes': 161000000000,
},
],
'network': {
'bytes_sent': 1234567890,
'bytes_recv': 9876543210,
'bytes_total': 11111111100,
},
'gpu': {
'available': false,
},
'hostname': 'test-server',
'queried_at': '2024-01-15T10:30:00Z',
};
// ============================================================
// Quick Links
// ============================================================
static const quickLinks = [
{
'id': 1,
'title': 'Portainer',
'url': 'https://portainer.example.com',
'icon': 'dns',
'category': 'Infrastructure',
'position': 0,
'is_visible': true,
'link_type': 'iframe',
},
{
'id': 2,
'title': 'Gitea',
'url': 'https://git.example.com',
'icon': 'code',
'category': 'Development',
'position': 1,
'is_visible': true,
'link_type': 'new_tab',
},
{
'id': 3,
'title': 'Jellyfin',
'url': 'https://media.example.com',
'icon': 'movie',
'category': 'Home',
'position': 2,
'is_visible': true,
'link_type': 'iframe',
},
];
static Map<String, dynamic> quickLink(int index) =>
Map<String, dynamic>.from(quickLinks[index]);
}
+1 -1
View File
@@ -164,7 +164,7 @@ class TestHarness {
/// Set up mock quick links response.
void givenQuickLinks([List<Map<String, dynamic>>? links]) {
api.whenGet('/quick-links', links ?? Fixtures.quickLinks);
api.whenGet('/dashboard/quick-links', links ?? Fixtures.quickLinks);
}
/// Set up mock system stats response.