I have a method in my controller that accepts a csv file sent as form-data.
import csv = require('csvtojson');
@Post('/create')
@UseInterceptors(FileInterceptor('file'))
async createUsers(@Query() query: RequestDTO, @UploadedFile() file: Express.Multer.File) {
const createJson = await csv().fromString(file.buffer.toString('utf-8'));
const response = this.myService.createUsers(query, createJson);
return response;
}
I just want to be able to mock it using Jest but I am not sure how to go about it.