79105309

Date: 2024-10-19 15:41:03
Score: 0.5
Natty:
Report link

The problem was the way I was exporting my repository functions, I use:

export default {
  fetch,
};

Instead

export const fetch = () => {}

and in the test file I did this way to stub my repository function

import repository from "../src/repository/product.repository.js";

fetchStub = sinon.stub(repository, "fetch");

and now the Sinon can identify my fetch function, of course I had to refactor my controller too

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Ed Angelis Ribeiro