On UNIT TESTING I'd recommend/remind (some of them may have exceptions when testing non-TDD legacy):
- given/when/then or arrange/act/assert structuring;
- use before each/ after each for setting up common resources;
- one assert per test method (or at least minimal, keeping it sane);
- avoid test interdependence;
- keep tests plan, free of if/ while/ for/ case and shared methods/ functions. Create methods for different conditions;
- duplicated code is better than shared functions/methods;
- do unit test behavior (input and output). Don't go spying on internal variables and dependencies as this may change and break tests, even when the inputs and outcomes are in compliance with the specification. (Ex: if you spy a call on a dependency of toBase64... and the dependency is not used anymore, test will break even if the input and output are right);
- exceptions are exceptions, we can't do much on legacy built without TDD in mind.