feat: Tenable-style patch_status - pending_updates, last_patch, reboot_pending across full stack
This commit is contained in:
51
server/web/src/test/fixtures.ts
Normal file
51
server/web/src/test/fixtures.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import type { Agent, Share, ServerInfo } from '../types';
|
||||
|
||||
export function mockAgent(overrides: Partial<Agent> = {}): Agent {
|
||||
return {
|
||||
id: 'agent-001-uuid',
|
||||
name: 'Test Miner',
|
||||
wallet: '4' + 'A'.repeat(94),
|
||||
ip: '192.168.1.10',
|
||||
version: '1.0.0',
|
||||
status: 'online',
|
||||
cpu_cores: 8,
|
||||
memory_gb: 16,
|
||||
last_seen: new Date().toISOString(),
|
||||
created_at: new Date().toISOString(),
|
||||
hashrate_15s: 500,
|
||||
hashrate_1m: 480,
|
||||
hashrate_15m: 450,
|
||||
shares_total: 100,
|
||||
shares_good: 95,
|
||||
shares_bad: 5,
|
||||
cpu_usage_pct: 42,
|
||||
memory_usage_pct: 55,
|
||||
uptime_seconds: 3600,
|
||||
platform: 'linux',
|
||||
arch: 'amd64',
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function mockShare(overrides: Partial<Share> = {}): Share {
|
||||
return {
|
||||
id: 1,
|
||||
agent_id: 'agent-001-uuid',
|
||||
job_id: 'job-1',
|
||||
difficulty: 1000,
|
||||
accepted: true,
|
||||
hash: 'abc123deadbeef',
|
||||
nonce: '0001',
|
||||
timestamp: new Date().toISOString(),
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export const mockServerInfo: ServerInfo = {
|
||||
port: 8080,
|
||||
host: '0.0.0.0',
|
||||
local_ips: ['192.168.1.5'],
|
||||
suggested_url: 'http://192.168.1.5:8080',
|
||||
dashboard_url: 'http://192.168.1.5:8080/dashboard',
|
||||
websocket_url: 'ws://192.168.1.5:8080/ws/dashboard',
|
||||
};
|
||||
1
server/web/src/test/setup.ts
Normal file
1
server/web/src/test/setup.ts
Normal file
@@ -0,0 +1 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
Reference in New Issue
Block a user