Ts Mockito Versions Save

Mocking library for TypeScript

v2.6.1

3 years ago

Now we can use: reset(firstMock, secondMock, thirdMock), resetCalls(firstMock, secondMock, thirdMock)

v2.5.0

4 years ago

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();

v2.4.0

4 years ago

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.

v2.3.0

6 years ago

Thanks to @johanblumenberg we got great new feature:

https://github.com/NagRock/ts-mockito#resolving--rejecting-promises

v2.2.10

6 years ago

v2.2.9

6 years ago

v2.2.8

6 years ago

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.

v2.2.7

6 years ago

v2.2.5

6 years ago