testing private methods in typescript with jest
It looks like you are wanting to verify that handleError gets called when build runs. Private methods are compiled to normal JavaScript prototype methods, so you can use the any type to let the spy creation pass through the TypeScript type checking. Here is a highly simplified example: class OrderBuilder { public build() { this.handleError() … Read more