A unit test checks a small behavior with as little surrounding system as practical. Explicit inputs and expected outputs make a broken rule easy to locate.
The demo feeds values into a function and compares the result with the expectation. Prefer observable behavior over implementation details so harmless refactors do not break tests.
When to use
Use it to check calculations, transformations, and validation rules quickly and repeatedly.