0

I am working on a Vue.js/Nuxt.js project using Vitest for testing.

I need to test that a method has been called by another method.

I attempt to spy on the called method, but I receive an « AssertionError: expected "getOperatorValue" to be called at least once », even though I can observe that it is being called during the test execution (console log inside).

Any ideas?

Here the code where you can have a look of methods and associated tests: https://stackblitz.com/edit/vitest-dev-vitest-nkdpmw

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Oliv
  • 1
  • Please put a [mre] in the question. But it looks like you're writing the wrong test, as I explain here: https://stackoverflow.com/a/70066090/3001761 (imagine you extracted `['=', '!=']` to a constant outside either function and accessed directly by both, a trivial refactor - should your tests start failing?!) – jonrsharpe Jul 12 '23 at 14:53

0 Answers0