Skip to content

Core unit test suite #5

@EmersonBraun

Description

@EmersonBraun

Parent PRD

#2

What to build

Add comprehensive unit tests directly to @agentskit/core. Currently core has zero direct tests — it's only exercised through packages/react/tests/. Core is the foundation everything depends on and needs its own test suite.

Cover: ChatController state machine (message lifecycle, streaming, abort, retry, tool execution, memory hydration), memory implementations (inMemory, localStorage, file — load/save/clear round-trips), shared primitives (executeToolCall, consumeStream, buildMessage), and AgentEvent emission.

Acceptance criteria

  • packages/core/tests/ directory created with vitest config
  • ChatController tests: send message → streaming → complete, abort mid-stream, retry after error, tool call execution and result injection
  • ChatController tests: memory hydration on init, memory save after message
  • ChatController tests: AgentEvent emission at each lifecycle point
  • Memory tests: inMemory round-trip, localStorage round-trip (with mock), file round-trip (with temp dir)
  • Shared primitive tests: executeToolCall with sync/async/streaming tools, consumeStream with chunks, buildMessage constructs valid Message
  • All tests pass, no flaky tests

Blocked by

User stories addressed

Quality gate — no direct user stories, but ensures foundation reliability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions