I'm new to testing. I've tried to research this, but with no luck.
Problem is, that I'm trying to test my app root file, called couples2.ts
, which is the entry for my NodeJS/TypeScript app.
It looks like this:
import App from "./app";
const app = new App();
app.run()
Now I'm trying to test whether the run()
function has been called, and so I wrote this couples2.test.ts
file with the following code, but it says that tests failed and the reason is that it's been called 0 times.
import App from "./app";
jest.mock('./app');
describe('couples2.ts file', () => {
it('should run the `run` function', function () {
const app = new App();
expect(app.run).toHaveBeenCalled();
});
})
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire