Skip to content

Add unit tests for skill-dispatcher module #239

@nikolasdehor

Description

@nikolasdehor

Problem

The skill-dispatcher.js module (363 lines) in .aios-core/core/orchestration/ has zero test coverage. This module maps agent IDs to AIOS Skill invocations and handles dispatch payloads, output parsing, and agent validation.

Solution

Add comprehensive unit tests covering:

  • Constructor — default options, skill mapping, agent personas, aliases
  • getSkillName — mapped agents, alias resolution, fallback for unknown agents
  • getAgentPersona — known agents, unknown fallback, aliases
  • buildDispatchPayload — complete payload construction, args string with task/output/phase/yolo, array creates handling, tech stack flags (database, frontend, TypeScript), missing context defaults
  • parseSkillOutput — null/undefined, structured objects, JSON in markdown code blocks, plain JSON strings, plain text truncation, invalid JSON fallback, unknown types
  • createSkipResult — all fields populated
  • formatDispatchLog — persona details, N/A fallback
  • getAvailableAgents — primary agents only, aliases excluded
  • isValidAgent — known agents, AIOS: prefix, unknown

Test Details

  • 39 tests across 8 describe blocks
  • No mocks needed (pure logic module)
  • All tests passing

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions