Jest equivalent for Chai respondTo

Viewed 15

I'm migrating a bunch of tests from Chai to Jest, because I'm more used to it, using NodeJS and Typescript.

One of the assertions is expect(transport).to.respondTo("query");

Which from the docs it should check that a method called query exists into transport.

From Jest docs a few alternatives could be:

  1. toHaveReturned
  2. .not.toThrow()
  3. toHaveProperty

The first one looks better to me. Is there something else that could be used instead?

0 Answers
Related