marchaos / jest-mock-extended

Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended
MIT License
828 stars 57 forks source link

Mocking boolean #38

Closed RobertSigma closed 4 years ago

RobertSigma commented 4 years ago
class Test {
    value: number;
    flag: boolean;
}

it('tests', () => {
    var t = mock<Test>({value: 123, flag: false});

    expect(t.value).toBe(123);
    expect(t.flag).toBeFalsy();
});

Running the above test fails with:

expect(received).toBeFalsy() Received: [Function mockConstructor]

Edit: Noticed that this is a duplicate of #30, for which a PR exists. Please merge it.

marchaos commented 4 years ago

Will merge, shortly.