mirror of
https://github.com/ruvnet/RuView.git
synced 2026-04-28 05:59:32 +00:00
The web UI had persistent 404 errors on model, recording, and training endpoints, and the sensing WebSocket never connected on Dashboard/Live Demo tabs because sensingService.start() was only called lazily on Sensing tab visit. Server (main.rs): - Add 14 fully-functional Axum handlers: model CRUD (7), recording lifecycle (4), training control (3) - Scan data/models/ and data/recordings/ at startup - Recording writes CSI frames to .jsonl via tokio background task - Model load/unload lifecycle with state tracking Web UI (app.js): - Import and start sensingService early in initializeServices() so Dashboard and Live Demo tabs connect to /ws/sensing immediately Mobile (ws.service.ts): - Fix WebSocket URL builder to use same-origin port instead of hardcoded port 3001 Mobile (jest.config.js): - Fix testPathIgnorePatterns that was ignoring the entire test directory Mobile (25 test files): - Replace all it.todo() placeholder tests with real implementations covering components, services, stores, hooks, screens, and utils ADR-043 documents all changes.
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import React from 'react';
|
|
import { render } from '@testing-library/react-native';
|
|
import { ThemeProvider } from '@/theme/ThemeContext';
|
|
|
|
jest.mock('react-native-svg', () => {
|
|
const { View } = require('react-native');
|
|
return {
|
|
__esModule: true,
|
|
default: View, // Svg
|
|
Svg: View,
|
|
Circle: View,
|
|
G: View,
|
|
Text: View,
|
|
Rect: View,
|
|
Line: View,
|
|
Path: View,
|
|
};
|
|
});
|
|
|
|
// GaugeArc uses Animated.createAnimatedComponent(Circle), so we need
|
|
// the reanimated mock (already in jest.setup.ts) and SVG mock above.
|
|
import { GaugeArc } from '@/components/GaugeArc';
|
|
|
|
const renderWithTheme = (ui: React.ReactElement) =>
|
|
render(<ThemeProvider>{ui}</ThemeProvider>);
|
|
|
|
describe('GaugeArc', () => {
|
|
it('renders without crashing', () => {
|
|
const { toJSON } = renderWithTheme(
|
|
<GaugeArc value={50} max={100} label="BPM" unit="bpm" color="#00FF00" />,
|
|
);
|
|
expect(toJSON()).not.toBeNull();
|
|
});
|
|
|
|
it('renders with min and max values', () => {
|
|
const { toJSON } = renderWithTheme(
|
|
<GaugeArc value={0} min={0} max={200} label="Test" unit="x" color="#FF0000" />,
|
|
);
|
|
expect(toJSON()).not.toBeNull();
|
|
});
|
|
|
|
it('renders with colorTo gradient', () => {
|
|
const { toJSON } = renderWithTheme(
|
|
<GaugeArc
|
|
value={75}
|
|
max={100}
|
|
label="HR"
|
|
unit="bpm"
|
|
color="#00FF00"
|
|
colorTo="#FF0000"
|
|
size={200}
|
|
/>,
|
|
);
|
|
expect(toJSON()).not.toBeNull();
|
|
});
|
|
|
|
it('renders with custom size', () => {
|
|
const { toJSON } = renderWithTheme(
|
|
<GaugeArc value={30} max={60} label="BR" unit="brpm" color="#0088FF" size={80} />,
|
|
);
|
|
expect(toJSON()).not.toBeNull();
|
|
});
|
|
});
|