ike18t/ts-mockery

Why was this so hard to find, am I missing something? Are there better alternatives?

Closed this issue · 1 comments

I just wanted to make a to-do implementation for TDD, and it took me like 30m to find decent mocking solution?..
image

For the scenario you have provided you don't even need mockery.

tasks(): Promise<Task[]> {
  return Promise.resolve([]); // no need for mockery in this instance
}

It is hard for me to gather complete context from the screenshot but if what you provided is an attempt to mock a function on an object then you could do something like:

Mock.of<TaskGetter>({ tasks: () => Promise.resolve([]) })