Skip to content

Commit 5538686

Browse files
ochafikclaude
andcommitted
fix: use sendHostContextChange for partial update accumulation test
Address PR review feedback: The test was using setHostContext with full context spreads which didn't clearly demonstrate partial update accumulation. Now uses sendHostContextChange directly to send truly partial updates (only theme, then only viewport), making it clear the App correctly merges multiple partial notifications. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 1a95181 commit 5538686

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/app-bridge.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,18 @@ describe("App <-> AppBridge integration", () => {
337337
await newBridge.connect(newBridgeTransport);
338338
await newApp.connect(newAppTransport);
339339

340-
// Update only theme
341-
newBridge.setHostContext({ ...initialContext, theme: "dark" });
340+
// Send partial update: only theme changes
341+
newBridge.sendHostContextChange({ theme: "dark" });
342342
await flush();
343343

344-
// Update viewport
345-
newBridge.setHostContext({
346-
theme: "dark",
347-
locale: "en-US",
348-
viewport: { width: 1024, height: 768 },
349-
});
344+
// Send another partial update: only viewport changes
345+
newBridge.sendHostContextChange({ viewport: { width: 1024, height: 768 } });
350346
await flush();
351347

352-
// getHostContext should have all updates merged
348+
// getHostContext should have accumulated all updates:
349+
// - locale from initial (unchanged)
350+
// - theme from first partial update
351+
// - viewport from second partial update
353352
const context = newApp.getHostContext();
354353
expect(context?.theme).toBe("dark");
355354
expect(context?.locale).toBe("en-US");

0 commit comments

Comments
 (0)