Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
test: cover video display wake
[._.]/ Adam Eivy7dadd5516b23
diff --git a/server/services/displayPower.test.js b/server/services/displayPower.test.jsnew file mode 100644index 0000000000..221056a33e--- /dev/null+++ b/server/services/displayPower.test.js@@ -0,0 +1,39 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++const state = vi.hoisted(() => ({+ platform: 'darwin',+ spawned: [],+}));++vi.mock('os', () => ({ platform: () => state.platform }));+vi.mock('../lib/childProcess.js', () => ({+ spawn: (cmd, args) => {+ state.spawned.push({ cmd, args });+ return { on: () => {}, unref: () => {} };+ },+}));++const { sleepDisplay, wakeDisplay } = await import('./displayPower.js');++beforeEach(() => {+ state.platform = 'darwin';+ state.spawned = [];+});++describe('displayPower', () => {+ it('wakes the display after an enabled GPU workload completes', () => {+ expect(sleepDisplay({}, 'Video generation')).toBe(true);+ expect(wakeDisplay({}, 'Video generation')).toBe(true);++ expect(state.spawned).toEqual([+ { cmd: 'pmset', args: ['displaysleepnow'] },+ { cmd: 'caffeinate', args: ['-u', '-t', '5'] },+ ]);+ });++ it('does not wake a display when the workload opted out', () => {+ expect(sleepDisplay({ displaySleep: false }, 'Video generation')).toBe(false);+ expect(wakeDisplay({ displaySleep: false }, 'Video generation')).toBe(false);+ expect(state.spawned).toEqual([]);+ });+});