Skip to content

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

949 B
Raw Blame
import { describe, it, expect } from 'vitest';
import { normalizeSuggestedAfter, SUGGESTED_AFTER_MAX } from './scheduleRunOrder.js';

describe('normalizeSuggestedAfter', () => {
  it('drops blanks, duplicates and self-references while keeping the chosen order', () => {
    expect(normalizeSuggestedAfter(['  simplify ', '', 'me', 'simplify', 'module-hygiene'], 'me'))
      .toEqual(['simplify', 'module-hygiene']);
  });

  it('treats a non-array (absent, null, a string) as no suggestion', () => {
    expect(normalizeSuggestedAfter(undefined)).toEqual([]);
    expect(normalizeSuggestedAfter(null)).toEqual([]);
    expect(normalizeSuggestedAfter('simplify')).toEqual([]);
  });

  it('caps a hand-edited list so a schedule file cannot grow one without bound', () => {
    const huge = Array.from({ length: SUGGESTED_AFTER_MAX + 5 }, (_, i) => `task-${i}`);
    expect(normalizeSuggestedAfter(huge)).toHaveLength(SUGGESTED_AFTER_MAX);
  });
});