Answer the question
In order to leave comments, you need to log in
How to write a unit test for a function that calls another function?
Suppose you have a utils.ts file like this (quite exaggerated example) that needs to be tested with Jest:
export function a(param: number): void {
const data = param * 2;
b(data);
}
export function b(param: number): void {
console.log(`This is param: ${param}`);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question