Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compare mock to an object with jest #125

Open
kasium opened this issue Aug 10, 2023 · 2 comments
Open

How to compare mock to an object with jest #125

kasium opened this issue Aug 10, 2023 · 2 comments

Comments

@kasium
Copy link

kasium commented Aug 10, 2023

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?

@zaid-hopstack
Copy link

zaid-hopstack commented Sep 6, 2023

@kasium I have the same question. Did you end up finding an answer for this?

@kasium
Copy link
Author

kasium commented Sep 6, 2023

@zaid-hopstack nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants