EspeoBlockchain / gardener-server

Node.js server for Gardener open source oracle project
MIT License
29 stars 6 forks source link

Refactor tests to use proper mocks #41

Open kss-espeo opened 5 years ago

kss-espeo commented 5 years ago

Currently, many of the Gardener tests use custom, promitive mocking mechanism. An example of that can be found in ExecuteReadyRequestsUseCase.spec.ts . They look like this: const fetchDataUseCase = () => ({ fetchData: () => Promise.resolve('fetchedData'), });

In scope of this task, refactor entire gardener-server codebase to use some standard mock mechanism instead. A specific technnique to be used is left to be researched but this looks promising: https://jestjs.io/docs/en/es6-class-mocks#automatic-mock .

kss-espeo commented 4 years ago

Use https://sinonjs.org/ and sinon.createStubInstance(Class)