Skip to content

Commit

Permalink
Merge pull request #66 from FormulaMonks/fix/cache-force-tool
Browse files Browse the repository at this point in the history
fix: correctly pass through the `forceTool` option inside `KurtCache.generateRawEvents`
  • Loading branch information
jemc authored Dec 10, 2024
2 parents 2ac7233 + 3de51b2 commit 93a974b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/kurt-cache/spec/KurtCache.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ class StubAdapter
}
forceTool?: string
}) {
// If there are tools, expect the forceTool to be set, because these tests
// don't use the "optional tools" feature. This lets us ensure that the
// forceTool is set correctly in the tests that use it.
if (Object.keys(options.tools).length > 0) {
expect(options.forceTool).toBeDefined()
}

// Emit the next canned response.
for (const bytes of this.nextCannedResponse()) {
yield { bytes }
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kurt-cache/src/KurtCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ export class KurtCache<A extends KurtAdapter>
),
},
adapter.generateRawEvents({
...options,
messages: adapter.transformToRawMessages(options.messages),
sampling: options.sampling,
tools: Object.fromEntries(
Object.entries(options.tools).map(([name, tool]) => [
name,
Expand Down

0 comments on commit 93a974b

Please sign in to comment.