Foldkit Release Expands Scene Testing Entry Points
Minor Changes cf98218: Rename the Scene and Story with step to given. Scene.with and Story.with are now Scene.given and Story.given. Story's exported WithStep type is now Story.GivenStep. Scene's... Uh oh! There was an error while loading. Please reload this page . There was an error while loading. Please reload this page . Uh oh! There was an error while loading. Please reload this page . Uh oh!…
In 0.135.0, Foldkit Scene tests can now cover every way a Message enters your program. This test walks through a successful WebSocket chat flow: the user connects, types a message, sends it, and sees it appear in the conversation. The important new step is: `ManagedResource.acquire(managedResources.chatSocket)` After the user clicks “Connect to Chat,” the Model requests the socket. `ManagedResource.acquire` verifies that the resource is actually requested, dispatches its declared `onAcquired` Message through update, and re-renders the view. Call it in the wrong state and the test throws. Scene already…
Read full post
covered Messages caused by view interactions, Commands, and Mounts. But there was no way to test Messages caused by Subscriptions, ManagedResources, or CustomElements without dropping out of Scene. This release fills all three gaps: - `Subscription.emit` for Messages reaching update from Subscriptions - `ManagedResource.acquire`, `failAcquire`, and `release` for Messages reaching update from ManagedResources - `CustomElement.emit` for typed CustomEvents It also adds `expectOutMessage` and `expectNoOutMessage` for Submodels, plus `withViewInputs` for testing Submodels that declare `ViewInputs`. Each Message enters through a step named after its real cause. These tests are especially valuable when agents are writing most of the implementation. Agents are excellent at producing them, and you can quickly verify the resulting behavior by reading them. My goal for Foldkit Scene and Story: tests should read like declarative specifications, not imperative test logic poking at your app. Release notes:
Just shipped a Foldkit release that fills in some gaps in Scene testing. But before I post about what’s new, here’s a reminder of what a Scene test looks like. Scene is one of Foldkit’s most powerful and underrated features. No other framework, including Elm and Lustre, gives you this out of the box. Someone correct me if I’m wrong there. Agents are…
Read full post
excellent at writing these, and the tests run fast because Scene operates directly on the VNode tree. No DOM, no browser, and no jsdom. And best of all: zero mocks! Commands are data. Scene never invokes their Effects. It tracks every Command until the test supplies a result Message. Every Command returned by update must be accounted for. If one goes unresolved, or update returns one you didn’t expect, the test fails. Docs:
Original title: Release foldkit@0.135.0 · foldkit/foldkit
Samuel Times preserves the original link so every selection remains auditable.

