I have written below code in nestjs.
export const multerOptions = {
storage: diskStorage({
destination: './uploads',
filename(_, file, callback) {
const randomName = Array(32)
.fill(null)
.map(() => Math.round(Math.random() * 16).toString(16))
.join('');
return callback(null, `${randomName}${extname(file.originalname)}`);
},
}),
}
when I am testing it is using below code.
it('should pick the file', () => {
const cb = jest.fn();
expect(multerOptions.storage).toBeTruthy();
expect(cb).toHaveBeenCalled();
expect(cb).toHaveBeenCalledTimes(1);
expect(cb()).toBeFalsy();
});
It is saying below lines of code is not covered.
const randomName = Array(32)
.fill(null)
.map(() => Math.round(Math.random() * 16).toString(16))
.join('');
return callback(null, `${randomName}${extname(file.originalname)}`);
what extra I need to include in my test case to cover these lines?