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.
Although this is for tracing bugs, since my question is specific to
csv-parserI thought maybe it's the right place to ask. (hope you don't mind)I have the following code to parse csv files:
I wanted to know how to mock this code in unit tests with jest. Any idea would be appreciated.