Skip to content

Add prependFixture() and getFixtures() public API#14

Merged
jpr5 merged 2 commits intomainfrom
feat/prepend-and-get-fixtures
Mar 5, 2026
Merged

Add prependFixture() and getFixtures() public API#14
jpr5 merged 2 commits intomainfrom
feat/prepend-and-get-fixtures

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented Mar 5, 2026

Summary

  • prependFixture(fixture) inserts a fixture at index 0 of the fixture list, replacing the addFixture() + splice/unshift hack via as any
  • getFixtures() returns a readonly Fixture[] view, replacing direct access to the private fixtures field via as any

Both methods are needed by ag-ui's e2e llmock-setup.ts to:

  1. Prepend a tool-result catch-all fixture that must match before substring-based fixtures
  2. Log fixture statistics (count predicates vs userMessage fixtures)

Test plan

  • 5 new tests in llmock.test.ts covering:
    • prependFixture inserts at front and returns this
    • prependFixture is visible to a running server (first-match-wins)
    • getFixtures returns all fixtures in order
    • getFixtures returns empty array when no fixtures added
    • getFixtures reflects mutations from clearFixtures
  • All 396 tests pass
  • Lint and format clean

prependFixture() inserts a fixture at the front of the list (index 0),
replacing the pattern of addFixture() + splice/unshift via `as any`.

getFixtures() returns a readonly view of the fixture array, replacing
direct access to the private `fixtures` field via `as any`.

Both methods are needed by ag-ui's e2e test setup to prepend a
tool-result catch-all fixture and log fixture statistics.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/CopilotKit/llmock/@copilotkit/llmock@14

commit: e9e8e72

@jpr5 jpr5 merged commit 374e899 into main Mar 5, 2026
8 checks passed
@jpr5 jpr5 deleted the feat/prepend-and-get-fixtures branch March 16, 2026 02:25
@jpr5 jpr5 mentioned this pull request Mar 19, 2026
4 tasks
jpr5 added a commit that referenced this pull request Apr 3, 2026
Add prependFixture() and getFixtures() public API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant