~/talk

Writing Testable Code

Talkat Commit Your Code 2025 Β· 2025-09-25..09-26Β· [testing]
slides:none on file

Claims that rebuilding 180,000 lines with 3,000 unit tests produces only three production bugs over two years and ties testability to low maintenance effort. Shows concrete refactors: breaking large promise spaghetti into smaller functions then converting promises to async/await for fewer paths to test. Demonstrates constructor injection and mocking by passing collaborators into constructors to replace globals and singletons, and reports that these changes make unit and integration tests straightforward and reliable.

AI-written summary Β· about

  1. 0:00Writing testable code
  2. 1:24First job's testing lessons
  3. 3:32Testable code traits
  4. 5:37Refactoring promise-based code
  5. 7:45Breaking promise chains
  6. 9:06Async/await simplification
  7. 10:14Avoiding heavy constructors
  8. 12:02Why constructors fail tests
  9. 13:48Passing dependencies
  10. 14:08Managing collaborators
  11. 15:12Reducing dependencies
  12. 16:35Brittle state and singletons
  13. 17:58Spooky action in tests
  14. 19:22Wrapping global state
  15. 20:45Mocking global dependencies
  16. 21:49When global state is okay
  17. 22:11Classes doing too much and how to fix
  18. 22:55Breaking down classes
  19. 23:36Code for others to test
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark β€” the status bar button does the same
?
this help
esc
close this, then clear every filter β€” or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.