Skip to content

How to compare mock to an object with jest #125

Open
@kasium

Description

I want to compare a mock to an object in jest but it won't work

        interface Foo {
            a: string;
            b: number;
        }

        const foo = mock<Foo>();
        foo.a = "bar";
        expect(foo).toStrictEqual({ a: "bar" });

Output:

    expect(received).toStrictEqual(expected) // deep equality

    Expected: {"a": "bar"}
    Received: undefined

Do you know why this is undefined?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions