Test that a faked function runs

While testing, Adonis provides an easy way to fake functions & classes. However is there a way to test that the faked function ran in the test.

In python, you can easily test if the function or method that you mocked/faked ran.

1 Like

I spent some time researching if this is possible with Adonis. It’s not. You may have to use a libary called Sinon.JS. Check here to see how to use it https://sinonjs.org/#get-started

2 Likes