Courses / Frontend Testing
5. Test-driven migration
Using tests to lock in behavior before refactoring or converting modules to TypeScript.
JavaScript
Test-driven migration
Write tests that pin current behavior so you can safely refactor or convert modules (for example to TypeScript) without changing observable behavior.
"I want to convert this file to TypeScript, but I can't risk changing what it does."
Before converting or refactoring code, write tests that capture its current inputs and outputs so the migration can be verified step-by-step. Tests act as a safety net and precise spec of existing behavior.
"I want to convert this file to TypeScript, but I can't risk changing what it does."
Before converting or refactoring code, write tests that capture its current inputs and outputs so the migration can be verified step-by-step. Tests act as a safety net and precise spec of existing behavior.