Jest mock with "new" instance

Viewed 420

I'm trying to test a method inside a class (ts). Inside that method, I'm creating a new instance of an external module.

public cancelEdit() {
    this.candidate = new Candidate(this.originalCandidate);
    this.controller.reset();
    this.editMode = false;
  }

When I check the code coverage from the test I notice that Candidate method is also covered (which means that I don't have a mock to this class).

What is wrong here? It's me using the "new" instance or I'm doing the mock in the wrong way?

0 Answers
Related