
An application checks whether a rollout list contains any unsupported runtime. The user only needs a warning indicator, so the first qualifying entry ends the work. Some returns a boolean and can terminate early. An empty rollout list provides no matching runtime.
Inspect the value before the UI formats it
The example keeps the input to Array.some outside the function, so it is possible to run the same transformation in a test. The comparison uses concrete data rather than the rendered component. If the application accepts a value from JSON, run the fixture after parsing that JSON to preserve the relevant types.
function evaluate(value) {
return value.some(v=>v<20);
}
const samples = [[22, 24], [22, 18, 24], []];
for (const sample of samples) console.log(evaluate(sample));What appears for each input
| Input | Return value |
|---|---|
| [22, 24] | False |
| [22, 18, 24] | True |
| [] | False |
For [22, 24], the observed output is False. With [22, 18, 24], it becomes True. Record both observations in the test that owns the public behaviour. A later refactor can swap the mechanics underneath it as long as the callers continue to receive the values they rely on.
For [], the answer is False. A test that checks only whether the program returned normally would miss a reversed condition. Assert the boolean directly and include the input in the failure message so a change can be reproduced.
When the integration needs another check
The numeric threshold is an example product policy. Compare semantic version tuples when the real requirement includes minor and patch versions.
Run one case twice through the real feature and look at both the displayed value and its stored representation. A component may coerce a result to text even when the implementation returns a yes-or-no decision. Keep a failing sample small enough that it can travel with a bug report, including the browser or Node version that produced it.
Turn the edge behaviour into a regression test
Add a fixture whose only unsupported target is the final element. An early successful run that only checks the first runtime cannot exercise the complete iteration, especially when a previous refactor introduced an unconditional return.
The same JavaScript function was also run with [] / [22] / [24, 22]. These additional inputs change the boundary without changing the implementation. An exception name in the table records where the operation rejects an input; a returned empty or zero value records a successful call. Choose deliberately which of those outcomes the surrounding feature should expose.
| Additional fixture | Result or exception |
|---|---|
| [] | False |
| [22] | False |
| [24, 22] | False |
JavaScript standard library reference · MDN JavaScript language guide
Sources and further reading
Cover photograph: Wikimedia Morocco Mini-Hackathon 2026 day 1 - Man using laptop at a desk with office chairs - 0024 by DERDAKI ILIAS. CC BY-SA 4.0. Cropped and typeset for this cover. The photograph illustrates the topic. This image adaptation uses the same share-alike license.
