Releases: NagRock/ts-mockito
Added possibility to reset and resetCalls for multiple mock instances
Type check support for deepEqual matcher
Thanks to @bricka we got support for deepEqual
matcher.
If provided arguments to deepEqual
matcher are compatible no action is required.
But this update can cause compilation errors on existing code if provided values to deepEqual
type is not compatible. For example if expected param has more fields than provided one.
For easy migration you can use Partial
class.
Before:
const expectedParams = {
sampleField: 'sampleValue',
};
verify(mock.test(deepEqual(expectedParams))).once();
From 2.5.0:
const expectedParams: Partial<MyArgumentType> = {
sampleField: 'sampleValue',
};
verify(mock.test(deepEqual(expectedParams))).once();
Support for interfaces
It took a lot of time but... looks like we've got support for interfaces 🎉
Simply use generic type for mock
function and omit argument for it:
let mockedInterface: MyInterface = mock<MyInterface>();
Great thanks for @johanblumenberg who created first implementation and pushed me to support interfaces. Thanks for your patience.
Fixed: Problem when library unintentionally tries to mock
Resolving / rejecting promises
Thanks to @johanblumenberg we got great new feature:
https://github.com/NagRock/ts-mockito#resolving--rejecting-promises
Default export without self import
v2.2.10 Default export without self import #65
Fixed Maximum call stack size exceeded error #82
v2.2.9 Fixed Maximum call stack size exceeded error #82
Fixed issue #80 instance function had different behavior with and without Proxy support
Fixed bug #80 that instance function worked different if Proxy was supported or not
With Proxy support instance function always returned new object, without support it was always same instance. Now instance function always returns same object.
Fixed issue #66 spying on object with property with defined value caused error
v2.2.7 Fixed issue #66 spying on object with property with defined value cau…
Added default export to allow ts-mockito to be used with ember-browserify
v2.2.5 Added default export to allow ts-mockito to be used with ember-browse…