src — mini-redux

tiny-test.mjs   ~30-line test runner (plumbing)
spec.mjs        executable specification — run this
store.js        ← YOU WRITE THIS
node spec.mjs

store.js must export createStore, combineReducers, applyMiddleware.

How to use the spec

Stages are ordered. Get stage 1 green before reading stage 3 — the tests are the build order from CONCEPTS.md §3, made runnable.

Stage 4 is the point of this module. Each of those tests corresponds to a real guard in Redux's source. Write the naive implementation first, watch stage 4 fail, and only then work out what the guard has to be. If you write the guards up front you will have copied Redux without understanding why any line exists.

Stage 5 passes when the bug is present. It is not a test of your store — it is a demonstration that a mutating reducer is undetectable by reference equality. Read it, do not "fix" it.

The spec deliberately does not cover enhancers, selectors, time travel or persistence (stages 4–8 of the build order). Those are yours to design and to test — writing that test file is part of the work.