mirror of
https://github.com/ruvnet/RuView.git
synced 2026-04-28 14:09:33 +00:00
fix: complete sensing server API, WebSocket connectivity, and mobile tests (#125)
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.
This commit is contained in:
parent
977da0f28e
commit
d4fb7d30d3
34 changed files with 2975 additions and 87 deletions
|
|
@ -1,5 +1,76 @@
|
|||
describe('placeholder', () => {
|
||||
it('passes', () => {
|
||||
expect(true).toBe(true);
|
||||
import { validateServerUrl } from '@/utils/urlValidator';
|
||||
|
||||
describe('validateServerUrl', () => {
|
||||
it('accepts valid http URL', () => {
|
||||
const result = validateServerUrl('http://localhost:3000');
|
||||
expect(result.valid).toBe(true);
|
||||
expect(result.error).toBeUndefined();
|
||||
});
|
||||
|
||||
it('accepts valid https URL', () => {
|
||||
const result = validateServerUrl('https://example.com');
|
||||
expect(result.valid).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts valid ws URL', () => {
|
||||
const result = validateServerUrl('ws://192.168.1.1:8080');
|
||||
expect(result.valid).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts valid wss URL', () => {
|
||||
const result = validateServerUrl('wss://example.com/ws');
|
||||
expect(result.valid).toBe(true);
|
||||
});
|
||||
|
||||
it('rejects empty string', () => {
|
||||
const result = validateServerUrl('');
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('URL must be a non-empty string.');
|
||||
});
|
||||
|
||||
it('rejects whitespace-only string', () => {
|
||||
const result = validateServerUrl(' ');
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('URL must be a non-empty string.');
|
||||
});
|
||||
|
||||
it('rejects null input', () => {
|
||||
const result = validateServerUrl(null as unknown as string);
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('URL must be a non-empty string.');
|
||||
});
|
||||
|
||||
it('rejects undefined input', () => {
|
||||
const result = validateServerUrl(undefined as unknown as string);
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('URL must be a non-empty string.');
|
||||
});
|
||||
|
||||
it('rejects numeric input', () => {
|
||||
const result = validateServerUrl(123 as unknown as string);
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('URL must be a non-empty string.');
|
||||
});
|
||||
|
||||
it('rejects ftp protocol', () => {
|
||||
const result = validateServerUrl('ftp://files.example.com');
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('URL must use http, https, ws, or wss.');
|
||||
});
|
||||
|
||||
it('rejects file protocol', () => {
|
||||
const result = validateServerUrl('file:///etc/passwd');
|
||||
expect(result.valid).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects malformed URL', () => {
|
||||
const result = validateServerUrl('not-a-url');
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.error).toBe('Invalid URL format.');
|
||||
});
|
||||
|
||||
it('rejects URL with no host', () => {
|
||||
const result = validateServerUrl('http://');
|
||||
expect(result.valid).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue