Releases: NagRock/ts-mockito
Releases · NagRock/ts-mockito
Fixed ObjectPropertyCodeRetriever toString issue
Fixed a null pointer exception occuring in some specific cases.
Fixed ProxyHandler ES5 type error
v2.2.3 Fixed ProxyHandler ES5 type error
Fixed verifying call count
Fixed #48
Fixed verifying call count when not all optional arguments was given
Mocking properties
Thanks to @Markus-Ende we can now mock propertie that aren't getters.
Please note, that stubbing properties that don't have getters only works if Proxy object is available (ES6).
Spying support
Thanks to @dreef3 we got new spying feature!
Usage:
const foo: Foo = new Foo();
const spiedFoo = spy(foo);
when(spiedFoo.getBar(3)).thenReturn('one');
console.log(foo.getBar(3)); // 'one'
console.log(foo.getBaz()); // call to a real method
Fixed mocking methods with optional arguments
v2.1.1 issue #36 - fixed mocking methods with optional arguments
Abstract and generic types mocking
Bug fix
2.0.0 New API for stubbing and capturing
All changes described in migration guide
Added functionality to change getter value
Now we can change getter value:
// Creating mock
let mockedFoo:Foo = mock(Foo);
// stub getter before execution
when(mockedFoo.sampleGetter).thenReturn('three');
// Getting instance
let foo:Foo = instance(mockedFoo);
// prints three
console.log(foo.sampleGetter);