Skip to content

Lesson 02 · Shipping

Testing: Proving Your Code Works

Turn manual checks into automated proof: unit tests that pin behavior, arrange-act-assert shape, a hand-rolled runner then node:test, edge cases, and what tests honestly cannot catch.

45 minintermediateShipping & Deployment

Prerequisites: JavaScript error handling & debugging

Learning objectives
By the end of this lesson, you will be able to:
  • Write a unit test in arrange-act-assert shape that pins one behavior of one function
  • Build a minimal test runner from scratch, then use node:test with equal, deepEqual and throws
  • Choose edge cases deliberately: empty input, single items, and both sides of every boundary
  • State honestly what unit tests cannot catch, and describe when to write tests first