garethpaul/poe-games-procedural-dungeons / .claude/skills/synced-store
synced-store
VerifiedBuild apps that USE synced-store for real-time multiplayer state. PROACTIVELY load when: designing a new Poe tile's state/schema (even before any file exists), discussing how to hide, gate, or restrict visibility of data to specific users or to the server, writing schema.ts/mutators/*.ts/client-config.ts/backend-config.ts for a Poe tile, using createPoeTileTestHarness, calling store.subscribe/store.mutate, or wiring entry.tsx with setupStore.
references/testing-bot-streaming.md
View on GitHub<!-- owner: jyoung-q -->
# Testing: Bot Streaming
`createPoeTileTestHarness` supports testing `Poe.stream()` and `Poe.call()` — pass a `getBotResponse` handler when creating the harness.
## Basic Usage
```typescript
import { createPoeTileTestHarness, textResponses } from "poe-tiles-sdk/v1/test-utils.js";
test("stream bot response", async () => {
const harness = createPoeTileTestHarness({
getBotResponse: textResponses(["Hello ", "World!"]),
});
const { Poe } = await harness.createClient();
const chunks = [];
for await (const chunk of Poe.stream({
botName: "Claude-3.5-Sonnet",
prompts: "Hi",
})) {
chunks.push(chunk);
}
expect(chunks).toHaveLength(2);
expect(chunks[0].text).toBe("Hello ");
expect(chunks[1].text).toBe("World!");
harness.dispose();
});
```
## Response Helpers
| Helper | Produces |
|--------|----------|
| `textResponse(str)` | Single-chunk text response |
| `textResponses([str, ...])` | Multiple chunks for one streaming call |
| `sequentialResponses([r1, r2, ...])` | Different response for each successive call |
| `errorResponse(err)` | Simulates an error during streaming |
## Custom `getBotResponse`
For fine-grained control, provide a function that returns an async iterable of chunks based on the request:
```typescript
const harness = createPoeTileTestHarness({
getBotResponse: async function* (request) {
if (request.botName === "GPT-4") {
yield { type: "text", text: "from GPT" };
} else {
yield { type: "text", text: "from default" };
}
},
});
```
The request object mirrors the production shape (botName, prompts, tools, etc.), so you can branch on any field the application uses.
## When to Use
- **Deterministic unit tests for AI-driven flows** — no real API calls, no flakiness, cheap to run thousands of times.
- **Error-path coverage** — simulate provider errors without needing quota or auth setup.
For action-level tests (server-side actions calling platform services), see [platform.md](platform.md) for the mock platform caller pattern.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |