0

I'm testing a module I'm developing in Ava. In one test, I provide something in the class constructor which causes the constructor to call an async function that defines a property to the class. I need to use this property to test something, but I'm unable to wait for the async function being called to finish since I don't have reference to it. However, at the end of the async function, it logs something.

Is there a way to wait for Spy.calledWith(arg) to be true to run a function that asserts in Ava?

If not, does anybody have any suggestions for what I could do otherwise? I would be able to call the async function directly, however, this would leave some things in the constructor uncovered when I'm shooting for 100% coverage.

As a last resort, I COULD have 2 different tests, but I'd really like to avoid that.

exoRift
  • 531
  • 1
  • 5
  • 13

0 Answers0