Open dstoyanoff opened 7 months ago
Hello,
@dstoyanoff
could you provide an example of the issue? It would help a lot to stay on the same page
Hey, sure.
Imagine I have a database repository and I want to mock a getById(id: string): User
function for multiple users. I could of course do that for every user, but since callback give us access to args, we could do it dynamically:
repoMock
.setup(repo => repo.getById('user_1'))
.callback(({ args }) => ({
id: args[0],
// ...some other props
}))
Since args
are of type any[]
, there is no type-safety in reading them, so it would be nice if we could do that the same way as it is for It.Is<T>
Feature request
Make callback accept a generic argument to type the the args returned in the
Expression