dice14u

Results 8 comments of dice14u

That is super strange that code doesn't compile for me .thenResolve("works") is resolving a null as a string Argument of type '"works"' is not assignable to parameter of type 'null'.ts(2345)...

``` import { anything, instance, mock, when } from 'ts-mockito'; describe("mocking class with async functions as fields", () => { it("should return mocked promise value", async () => { class...

Using ts-mockito 2.3.1, jest 23.3.8, ts-node 7.0.1 Thinking it might actually be something with running it under ts-node

did some upgrades and tried running it under ts-node as its own file ```javascript import { mock, when, anything, instance } from "ts-mockito"; const main = async () => {...

Figured out the difference in my tsconfig.json ```json { "compilerOptions": { "sourceMap": true, "target": "es2016", "lib": ["esnext.asynciterable", "es7", "dom"] }, } ``` works ```json { "compilerOptions": { "sourceMap": true, "target":...

The thing is since its a property and not a method I suppose really the work around is to do mockFunc = mock(() => null); when(mockedWithAsyncFields.error).doReturn(instance(mockFunc)); closing because ".error" is...

First make sure that you are using an instance of the mock not the mock itself, You need to create an instance of the mock not the mock itself mockito.when(client.getOutgoingHandler()).thenReturn(instance(outgoingMock));