Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Dashboard ambient layer, comrade presence, Mission Deck and War Room, Emberwake supply chain, spread/docs publishing, fleet policy and modules API, CI docker mining, and refreshed USB pack.
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
capabilitiesMatchModule,
|
|
findFleetModule,
|
|
moduleFeatureFlags,
|
|
modulePushLabel,
|
|
resolveFleetModules,
|
|
} from './fleetModules';
|
|
import type { FleetModuleManifest } from '../types';
|
|
|
|
const crucible: FleetModuleManifest = {
|
|
name: 'crucible_ops',
|
|
version: '1',
|
|
display_name: 'Crucible Ops',
|
|
features: { remote_aggressive: true },
|
|
};
|
|
|
|
describe('fleetModules', () => {
|
|
it('falls back to built-in packs when list is empty', () => {
|
|
const list = resolveFleetModules([]);
|
|
expect(list.map((m) => m.name)).toEqual(['crucible_ops', 'spread', 'gpu']);
|
|
});
|
|
|
|
it('builds guided push label for group target', () => {
|
|
expect(modulePushLabel(crucible, 'group', 'Alpha Squad')).toBe('Push Crucible Ops to Alpha Squad');
|
|
});
|
|
|
|
it('builds guided push label for all online', () => {
|
|
expect(modulePushLabel(crucible, 'all', undefined, 3)).toBe('Push Crucible Ops to all online (3)');
|
|
});
|
|
|
|
it('lists feature flags from manifest', () => {
|
|
expect(moduleFeatureFlags({ name: 'spread', version: '1', features: { auto_spread: true, usb_spread: true } })).toEqual([
|
|
'auto_spread',
|
|
'usb_spread',
|
|
]);
|
|
});
|
|
|
|
it('detects when agent capabilities match a staged pack', () => {
|
|
expect(
|
|
capabilitiesMatchModule({ remote_aggressive: true } as import('../types').AgentCapabilities, crucible),
|
|
).toBe(true);
|
|
expect(
|
|
capabilitiesMatchModule({ remote_aggressive: false } as import('../types').AgentCapabilities, crucible),
|
|
).toBe(false);
|
|
});
|
|
|
|
it('finds pack by name', () => {
|
|
expect(findFleetModule([], 'gpu')?.display_name).toBe('GPU Miner');
|
|
});
|
|
});
|