Skip to content

updated tests with mock function#3

Open
Knijus wants to merge 1 commit into
mainfrom
horse_duals
Open

updated tests with mock function#3
Knijus wants to merge 1 commit into
mainfrom
horse_duals

Conversation

@Knijus

@Knijus Knijus commented Dec 9, 2021

Copy link
Copy Markdown
Owner

No description provided.

Comment on lines +2 to +4
const testSubject = require('../src/index');
const fs = require('fs');
const path = require("path");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually imports are at the top of the file.

expect(output).toBe(1);
});
beforeAll(() => {
console.log = jest.fn();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with Jest, however you need to make sure, that after this test suite is done, console.log continues to work as expected. You can make sure by reading documentation about jest.resetAllMocks, and what it does exactly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants