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
import { afterEach, describe, expect, it } from 'vitest';
import { cleanup, render, screen } from '@testing-library/react';
import PromptEditor from './PromptEditor';
afterEach(cleanup);
describe('PromptEditor', () => {
it('explains that hook-owned prompts are generated per run', () => {
render(
<PromptEditor
config={{
promptMode: 'runtime-generated',
promptDescription: 'Generated from fresh forge activity.'
}}
promptValue=""
setPromptValue={() => {}}
editingPrompt={false}
setEditingPrompt={() => {}}
handleSavePrompt={() => {}}
updating={false}
activeApps={[]}
/>
);
expect(screen.getByText('Generated at run time')).toBeInTheDocument();
expect(screen.getByText('Generated from fresh forge activity.')).toBeInTheDocument();
expect(screen.getByText(/no stored prompt template to edit/i)).toBeInTheDocument();
expect(screen.queryByText('No prompt configured')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Edit' })).not.toBeInTheDocument();
});
});
describe('PromptEditor — pipeline stages past the icon table', () => {
it('gives every stage an icon so the mobileCompact bar stays an icon row', () => {
// Stages are data-driven and unbounded against a 16-entry STAGE_ICONS
// table. One iconless tab drops the whole bar to the <select> fallback
// (TabPills' `iconRow` gate), so the 17th stage must still render a glyph.
const stages = Array.from({ length: 17 }, (_, i) => ({ name: `Stage ${i + 1}` }));
const { container } = render(
<PromptEditor
config={{
taskMetadata: { pipeline: { stages } },
stagePrompts: stages.map((stage) => `Prompt for ${stage.name}`),
}}
promptValue=""
setPromptValue={() => {}}
editingPrompt={false}
setEditingPrompt={() => {}}
handleSavePrompt={() => {}}
updating={false}
activeApps={[]}
/>
);
expect(container.querySelector('select')).toBeNull();
const tabs = screen.getAllByRole('tab');
expect(tabs).toHaveLength(17);
for (const tab of tabs) {
expect(tab.querySelector('svg')).not.toBeNull();
}
});
});
describe('PromptEditor — programmatic tasks', () => {
it('offers no prompt at all for work PortOS performs itself', () => {
// Distinct from 'runtime-generated': there is no agent and no prompt, so
// offering to show or edit one would describe execution that never happens.
render(
<PromptEditor
config={{
promptMode: 'programmatic',
promptDescription: 'PortOS enqueues the renders itself.'
}}
promptValue=""
setPromptValue={() => {}}
editingPrompt={false}
setEditingPrompt={() => {}}
handleSavePrompt={() => {}}
updating={false}
activeApps={[]}
/>
);
expect(screen.getByText('No prompt — PortOS runs this itself')).toBeInTheDocument();
expect(screen.getByText('PortOS enqueues the renders itself.')).toBeInTheDocument();
expect(screen.queryByText('Generated at run time')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Edit' })).not.toBeInTheDocument();
});
});