Write unit test

Write unit test in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
Add a unit test that verifies the Save button calls onSave with the form values. Render the…
Add a unit test that verifies the Save button calls onSave with the form values. Render the component with initial values, simulate changing the title and clicking Save, and assert the mock onSave was called once with the updated title and other fields unchanged.

Improve — make it easier to accept

+
Before I run the test suite, make this unit test easy to approve: keep the Arrange step minimal,…
Before I run the test suite, make this unit test easy to approve: keep the Arrange step minimal, name the mocked functions and expected payload clearly, avoid implementation details like internal timers, and flag where flaky behavior could occur (async validation, debounced handlers).

Decide — diagnose the stuck moment

+
A unit test that asserts a callback was called flakes in CI. Locally it passes. The component uses…

Test intermittently fails in CI but passes locally

A unit test that asserts a callback was called flakes in CI. Locally it passes. The component uses a debounced save and a Promise in an effect. I don't know whether the flakiness is timing or environment. What is the likely cause and the smallest change to make the test deterministic and reliable in CI?

Become — change the pattern

+
Our test suite accumulates flaky unit tests whenever components use timers, debounce, or fetches.…

many flaky tests around async UI behavior

Our test suite accumulates flaky unit tests whenever components use timers, debounce, or fetches. Each fix is a one-off and the suite slows down. Which single testing habit will most reduce flakiness and speed feedback, and what concrete change should I make to the test helper library to enforce it?

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.