Do not write tests for private methods. This defeats the point of unit tests.
Example
class SomeClass {
public addNumber(a: number, b: number) {
return a + b;
}
}
The test for this method should not need to change if later the implementation changes but the behaviour
of the public API remains the same.
class SomeClass {
public addNumber(a: number, b: number) {
return this.add(a, b);
}
private add(a: number, b: number) {
return a + b;
}
}
Don't make methods and properties public just in order to test them. This usually means that either: