mbraude / TeddyMocks

A simple mock framework for Javascript, written in and optimized for TypeScript development
8 stars 3 forks source link

Does it call the original methods? #1

Closed llehn closed 8 years ago

llehn commented 9 years ago

First, thanks for publishing it! I'm having problems suppressing calls to original's type methods, maybe it's a misunderstanding of how teddymocks works.

What I expected was: When I mock type T with

var mock = new TeddyMocks.Stub<MyType>(MyType);

I thought I could pass mock.object to any object which requires an instance of MyType. When this object calls any methods on MyType, they do nothing per default and I can "add" behaviour to the mock via

mock.stubs(...

What I see is that when the object calls a method from MyType (using mock.object) this leads to the call of the original method of MyType, somehow defeating the purpose of mocking. I'm sure I'm using it wrong or I overlooked something.

Thanks in advance