Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to mock with jest #450

Open
vahidvdn opened this issue Dec 19, 2024 · 0 comments
Open

Question: how to mock with jest #450

vahidvdn opened this issue Dec 19, 2024 · 0 comments

Comments

@vahidvdn
Copy link

Although this is for tracing bugs, since my question is specific to csv-parser I thought maybe it's the right place to ask. (hope you don't mind)

I have the following code to parse csv files:

const records = [];
const parser = fs
  .createReadStream(`${process.cwd()}/${file.destination}/${file.filename}`)
  .pipe(parse({}));

for await (const record of parser) {
  records.push(record);
}

I wanted to know how to mock this code in unit tests with jest. Any idea would be appreciated.

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

No branches or pull requests

1 participant