I'm newbie in testing JS so here's my question.
I have function which is using filesystem methods existsSync and mkdirSync. And of course I want to test this function. Should I mock the fs and return simple bool? Should I make the jest to physically create directory and check if it exists?
if (!existsSync(currentPath)) {
mkdirSync(currentPath);
}
TL;DR: How to test this code?
Aucun commentaire:
Enregistrer un commentaire