Feature request: reset function for MockObjects
Closed this issue · 0 comments
dhardtke commented
If I have a MockObject and I want to reset that right now I have to reset each individual MockFn separately.
Instead, it would be handy if I could just call a reset function and pass the MockObject, e.g.
const mockObj = mockObject<UserService>({
authenticate(id: string): Token {
// ...
}
});
resetMockObject(mockObj);
Notice: I think it is better to provide an exported function that takes a MockObject than to provide a reset() function on every instance of MockObject to avoid naming collisions.
Alternatively, the name could be very unique (think "resetMockObject()" on the MockObject) but this is kind of a workaround, only.