Files
labFusion/frontend/src/App.test.js
glenn schrooyen 8c87c84208
Some checks failed
API Docs (Node.js Express) / test (16) (push) Failing after 5m42s
API Docs (Node.js Express) / test (20) (push) Has been cancelled
API Docs (Node.js Express) / build (push) Has been cancelled
API Docs (Node.js Express) / security (push) Has been cancelled
API Docs (Node.js Express) / test (18) (push) Has been cancelled
LabFusion CI/CD Pipeline / api-gateway (push) Has been cancelled
LabFusion CI/CD Pipeline / service-adapters (push) Has been cancelled
LabFusion CI/CD Pipeline / api-docs (push) Has been cancelled
LabFusion CI/CD Pipeline / frontend (push) Has been cancelled
LabFusion CI/CD Pipeline / integration-tests (push) Has been cancelled
LabFusion CI/CD Pipeline / security-scan (push) Has been cancelled
Docker Build and Push / build-and-push (push) Has been cancelled
Docker Build and Push / security-scan (push) Has been cancelled
Docker Build and Push / deploy-staging (push) Has been cancelled
Docker Build and Push / deploy-production (push) Has been cancelled
Frontend (React) / test (16) (push) Has been cancelled
Frontend (React) / test (18) (push) Has been cancelled
Frontend (React) / test (20) (push) Has been cancelled
Frontend (React) / build (push) Has been cancelled
Frontend (React) / lighthouse (push) Has been cancelled
Frontend (React) / security (push) Has been cancelled
Integration Tests / performance-tests (push) Has been cancelled
Service Adapters (Python FastAPI) / security (push) Has been cancelled
Service Adapters (Python FastAPI) / test (3.1) (push) Has been cancelled
Service Adapters (Python FastAPI) / test (3.11) (push) Has been cancelled
Service Adapters (Python FastAPI) / test (3.12) (push) Has been cancelled
Service Adapters (Python FastAPI) / test (3.9) (push) Has been cancelled
Service Adapters (Python FastAPI) / build (push) Has been cancelled
Integration Tests / integration-tests (push) Has been cancelled
Update CI workflows for Python linting by increasing flake8 line length limit to 150 characters for better readability; adjust service-adapters.yml and ci.yml accordingly; update progress documentation
2025-09-12 22:42:47 +02:00

59 lines
1.5 KiB
JavaScript

import React from 'react'
import { render, screen } from '@testing-library/react'
import App from './App'
// Mock the service status hook to avoid API calls during tests
jest.mock('./hooks/useServiceStatus', () => ({
useServiceStatus: () => ({
isOnline: true,
services: {
'api-gateway': { status: 'healthy', lastCheck: new Date().toISOString() },
'service-adapters': { status: 'healthy', lastCheck: new Date().toISOString() },
'api-docs': { status: 'healthy', lastCheck: new Date().toISOString() }
},
isLoading: false,
error: null
})
}))
// Mock the system data hook
jest.mock('./hooks/useServiceStatus', () => ({
useSystemData: () => ({
systemStats: {
cpuUsage: 45.2,
memoryUsage: 2.1,
diskUsage: 75.8
},
recentEvents: [
{
id: '1',
timestamp: new Date().toISOString(),
service: 'api-gateway',
event_type: 'health_check',
metadata: 'Service is healthy'
}
],
isLoading: false,
error: null
})
}))
describe('App Component', () => {
it('renders without crashing', () => {
render(<App />)
expect(screen.getByText(/LabFusion/i)).toBeInTheDocument()
})
it('renders the main dashboard', () => {
render(<App />)
// Check for common dashboard elements
expect(screen.getByText(/Dashboard/i)).toBeInTheDocument()
})
it('shows service status when online', () => {
render(<App />)
// Should show service status information
expect(screen.getByText(/Service Status/i)).toBeInTheDocument()
})
})